Struct warmy::Key
[−]
[src]
pub struct Key<T> where
T: Load, { /* fields omitted */ }
Key used to get resource.
This is the single type used to query into Store
. A key is a DepKey
with phantom typing,
giving type hints on the target resource.
You can use the Key::path
and Key::logical
functions to create new keys.
let the_key = Key::path("maps/deck_16/room_3.bsp");
Methods
impl<T> Key<T> where
T: Load<Key = PathKey>,
[src]
T: Load<Key = PathKey>,
fn path<P>(path: P) -> Result<Self> where
P: AsRef<Path>,
[src]
P: AsRef<Path>,
Create a new key from a path.
Because the path needs to be canonicalized, this function might fail if the canonicalization cannot happen.
fn as_path(&self) -> &Path
[src]
Get the underlying, canonicalized path.
impl<T> Key<T> where
T: Load<Key = LogicalKey>,
[src]
T: Load<Key = LogicalKey>,
fn logical(id: &str) -> Self
[src]
Create a new logical key.
fn as_str(&self) -> &str
[src]
Get the underlying name.
Trait Implementations
impl<T> Clone for Key<T> where
T: Load,
T::Key: Clone,
[src]
T: Load,
T::Key: Clone,
fn clone(&self) -> Self
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<T> Debug for Key<T> where
T: Load,
T::Key: Debug,
[src]
T: Load,
T::Key: Debug,
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
[src]
Formats the value using the given formatter.
impl<T> Eq for Key<T> where
T: Load,
T::Key: Eq,
[src]
T: Load,
T::Key: Eq,
impl<T> Hash for Key<T> where
T: Load,
T::Key: Hash,
[src]
T: Load,
T::Key: Hash,
fn hash<H>(&self, state: &mut H) where
H: Hasher,
[src]
H: Hasher,
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl<T> PartialEq for Key<T> where
T: Load,
T::Key: PartialEq,
[src]
T: Load,
T::Key: PartialEq,
fn eq(&self, rhs: &Self) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl<T> CacheKey for Key<T> where
T: 'static + Load,
T::Key: Hash,
[src]
T: 'static + Load,
T::Key: Hash,