api: replace WindowId From/Into u64 with WindowId::{from,into}_raw()
Co-authored-by: Mads Marquart <mads@marquart.dk> Co-authored-by: Kirill Chibisov <contact@kchibisov.com>
This commit is contained in:
parent
380eea0072
commit
6e1b9fa24d
10 changed files with 62 additions and 93 deletions
|
|
@ -34,6 +34,20 @@ impl WindowId {
|
|||
pub const fn dummy() -> Self {
|
||||
WindowId(platform_impl::WindowId::dummy())
|
||||
}
|
||||
|
||||
/// Convert the `WindowId` into the underlying integer.
|
||||
///
|
||||
/// This is useful if you need to pass the ID across an FFI boundary, or store it in an atomic.
|
||||
pub const fn into_raw(self) -> u64 {
|
||||
self.0.into_raw()
|
||||
}
|
||||
|
||||
/// Construct a `WindowId` from the underlying integer.
|
||||
///
|
||||
/// This should only be called with integers returned from [`WindowId::into_raw`].
|
||||
pub const fn from_raw(id: u64) -> Self {
|
||||
Self(platform_impl::WindowId::from_raw(id))
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Debug for WindowId {
|
||||
|
|
@ -42,18 +56,6 @@ impl fmt::Debug for WindowId {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<WindowId> for u64 {
|
||||
fn from(window_id: WindowId) -> Self {
|
||||
window_id.0.into()
|
||||
}
|
||||
}
|
||||
|
||||
impl From<u64> for WindowId {
|
||||
fn from(raw_id: u64) -> Self {
|
||||
Self(raw_id.into())
|
||||
}
|
||||
}
|
||||
|
||||
/// Attributes used when creating a window.
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct WindowAttributes {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue