[−][src]Struct rscache::ItemLoader
Caches all the item definitions that were loaded.
Fields
items: HashMap<u16, ItemDefinition>Implementations
impl ItemLoader[src]
pub fn new(cache: &Cache) -> Result<Self, CacheError>[src]
Constructs a new ItemLoader.
It loads all the item definitions and caches them.
Errors
If this function encounters any errors it will be wrapped
in a CacheError. (ReadErrors or I/O errors)
Examples
use rscache::ItemLoader; let item_loader = ItemLoader::new(&cache)?;
pub fn load(&self, id: u16) -> Option<&ItemDefinition>[src]
Retrieves the ItemDefinition for the given item id.
Examples
// blue partyhat id = 1042 let blue_partyhat = item_loader.load(1042); match blue_partyhat { Some(blue_partyhat) => { assert_eq!("Blue partyhat", blue_partyhat.name); assert_eq!(false, blue_partyhat.stackable); assert_eq!(false, blue_partyhat.members_only); }, None => (), }
Auto Trait Implementations
impl RefUnwindSafe for ItemLoader
impl Send for ItemLoader
impl Sync for ItemLoader
impl Unpin for ItemLoader
impl UnwindSafe for ItemLoader
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, 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>,