-
Notifications
You must be signed in to change notification settings - Fork 114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
matchmaking servers wrapper #177
Conversation
fix callback closure dropping from inside
@Noxime Hi, can you review this when you have time? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the PR; This is a lot of work and I'm grateful. I don't have much feedback, just some notes on type convenience. The macro stuff looks quite scary (especially the vtable parts) and I'm not very good at verifying that stuff. I trust you write sensible code 😄
src/matchmaking_servers.rs
Outdated
pub max_players: i32, | ||
pub server_version: i32, | ||
pub steamid: u64, | ||
pub last_time_played: std::time::Duration, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
time (in unix time) when this server was last played on (for favorite/history servers)
I think it would be more useful to have this as anInstant
instead of a duration since unix epoch. Might be annoying to convert, however 🤷
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As i know there's no method to create Instant
from milliseconds
Github marked as outdated, just changed std::time::Duration
to Duration
src/matchmaking_servers.rs
Outdated
pub have_password: bool, | ||
pub secure: bool, | ||
pub bot_players: i32, | ||
pub ping: i32, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Either document the unit (milliseconds) or better yet, convert to Duration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea, will convert to Duration
Just done rewriting it to see if it will work. You can check it in the What do you think of this rewritten version? |
Result is #[must_use] unlike Option, so it is better to use Result in this case
To summarize what I have for now. There are two slightly different wrappers for the history requests. Both works well and are ready to merge. Each one has it's pros and cons:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like this part of Steamworks 😅 overall though, I think I prefer this approach. Covering more of the features is important, and the "risk" of not releasing a request is still safe, just wasteful. It's a lesser evil; The cons of this approach are less severe than in history-rewrite
. We can always revisit this API and rework, if it causes a lot of issues.
Thank you for you work, you have put a lot of effort in!
No description provided.