[−][src]Struct handy::typed::TypedHandle
A TypedHandle
is a wrapper around a Handle
which gives you some
additional type safety, should you desire. You use it with a
TypedHandleMap
, which only will accept handles of the correct type. This
could be useful if you have several handle maps in your program, and find
TypedHandle<T>
is Copy + Send + Sync (and several others) regardless of
T
, which is not true for a naïve implementation of this, so it's provided
even though I don't think it's that helpful for most usage (handle maps
already detect this at runtime).
Implementations
impl<T> TypedHandle<T>
[src]
pub const EMPTY: Self
[src]
The TypedHandle
equivalent of Handle::EMPTY
.
pub const fn from_handle(h: Handle) -> Self
[src]
Construct a typed handle from an untyped Handle
.
This typically shouldn't be necessary if you're using typed maps exclusively, but could be useful when building abstractions on top of handles.
pub const fn handle(self) -> Handle
[src]
Access the wrapped untyped handle.
This typically shouldn't be necessary if you're using typed maps
exclusively, but could be useful when building abstractions on top of
handles, as well as for accessing the accessors on Handle
which are
not otherwise directly exposed on TypedHandle
.
pub const fn from_raw_parts(index: usize, generation: u16, meta: u16) -> Self
[src]
Construct a handle from the separate parts.
Warning
This is a feature intended for advanced usage. An attempt is made to cope with dubious handles, but it's almost certainly possible to pierce the abstraction veil of the HandleMap if you use this.
However, it should not be possible to cause memory unsafety -- this crate has no unsafe code.
pub const fn from_raw(value: u64) -> Self
[src]
Construct a handle from it's internal u64
value.
See the documentation for Handle::from_raw
for further info.
Warning
This is a feature intended for advanced usage. An attempt is made to cope with dubious handles, but it's almost certainly possible to pierce the abstraction veil of the HandleMap if you use this.
However, it should not be possible to cause memory unsafety -- this crate has no unsafe code.
pub const fn into_raw(self) -> u64
[src]
Get the internal u64 representation of this handle.
See the documentation for Handle::into_raw
for further info.
pub const fn index(self) -> usize
[src]
Returns the index value of this handle.
While a usize is returned, this value is guaranteed to be 32 bits.
See the documentation for Handle::index
for further info.
pub const fn generation(self) -> u16
[src]
Returns the generation value of this handle.
See the documentation for Handle::generation
for further info.
pub const fn meta(self) -> u16
[src]
Returns the metadata field of this handle.
See the documentation for Handle::meta
for further info.
pub const fn map_id(self) -> u16
[src]
Returns the metadata field of this handle. This is an alias for
map_id
, as in the common case, this is what the metadata field is used
for.
See Handle::meta
for more info.
Trait Implementations
impl<T> Clone for TypedHandle<T>
[src]
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T> Copy for TypedHandle<T>
[src]
impl<T> Debug for TypedHandle<T>
[src]
impl<T> Default for TypedHandle<T>
[src]
impl<T> Eq for TypedHandle<T>
[src]
impl<T> Hash for TypedHandle<T>
[src]
fn hash<H: Hasher>(&self, h: &mut H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<T> Index<TypedHandle<T>> for TypedHandleMap<T>
[src]
impl<T> IndexMut<TypedHandle<T>> for TypedHandleMap<T>
[src]
fn index_mut(&mut self, h: TypedHandle<T>) -> &mut T
[src]
impl<T> Ord for TypedHandle<T>
[src]
fn cmp(&self, o: &Self) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl<T> PartialEq<TypedHandle<T>> for TypedHandle<T>
[src]
impl<T> PartialOrd<TypedHandle<T>> for TypedHandle<T>
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,