Skip to content

Commit

Permalink
set_key_value arguments String -> &str, use unwrap as in other methods
Browse files Browse the repository at this point in the history
  • Loading branch information
ymo-4 committed Jul 18, 2024
1 parent 2343381 commit cb37916
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,17 +353,13 @@ impl Server {
}
}

pub fn set_key_value(&self, key: String, value: String) -> Result<(), std::ffi::NulError> {
let key = CString::new(key)?;
let value = CString::new(value)?;
/// Add/update a rules key/value pair.
pub fn set_key_value(&self, key: &str, value: &str) {
let key = CString::new(key).unwrap();
let value = CString::new(value).unwrap();

unsafe {
Ok(
sys::SteamAPI_ISteamGameServer_SetKeyValue(
self.server,
key.as_ptr(),
value.as_ptr()
))
sys::SteamAPI_ISteamGameServer_SetKeyValue(self.server, key.as_ptr(), value.as_ptr());
}
}

Expand Down

0 comments on commit cb37916

Please sign in to comment.