[][src]Struct yy_boss::YyResourceHandler

pub struct YyResourceHandler<T: YyResource> { /* fields omitted */ }

Implementations

impl<T: YyResource> YyResourceHandler<T>[src]

pub fn get(&self, name: &str) -> Option<&YyResourceData<T>>[src]

Returns an immutable reference to a resource's data, if it exists.

Since associated data is lazily loaded, and be unloaded at any time, there may not be any associated data returned. You can request that data to be loaded using load_resource_associated_data.

pub unsafe fn get_mut(&mut self, name: &str) -> Option<&mut YyResourceData<T>>[src]

Returns an mutable reference to a resource's data, if it exists.

Since associated data is lazily loaded, and be unloaded at any time, there may not be any associated data returned. You can request that data to be loaded using load_resource_associated_data.

Safety

This function is VERY UNSAFE, but not in a memory sense. The entire purpose of this library is, in effect, to shield the user from making changes to the Yyp database which require side effects. How could a user know which effects to use and what to not use? They absolutely cannot. Unless you are very certain that the change you are making will not impact anything outside that file, do not use this function.

Additionally, be aware that mutating data does not guarentee serialization: please use force_serialize.

pub fn force_serialize(
    &mut self,
    name: &str
) -> Result<(), YyResourceHandlerError>
[src]

Attempts to mark a resource for serialization, and returns if it was succesfully marked.

pub fn load_resource_associated_data(
    &mut self,
    resource_name: &str,
    root: &Path,
    tcu: &TrailingCommaUtility
) -> Result<&T::AssociatedData, YyResourceHandlerError>
[src]

Loads in the associated data of a given resource name, if that resource exists and is managed.

If that resource already has some associated data, it will be discarded, and the new data will be loaded. If the resource does not exist or is not of the type that this manager handles, an error will be returned.

pub fn unload_resource_associated_data(
    &mut self,
    resource_name: &str
) -> Result<(), YyResourceHandlerError>
[src]

Unloads a resource. This will free up some memory.

If the resource does not exist on this handler, an error will be returned.

impl YyResourceHandler<Object>[src]

pub fn add_event(&mut self, identifier: &str, event_type: EventType) -> bool[src]

pub fn remove_event(&mut self, identifier: &str, event_type: EventType) -> bool[src]

Trait Implementations

impl<T: Debug + YyResource> Debug for YyResourceHandler<T>[src]

impl<T: YyResource> Default for YyResourceHandler<T>[src]

impl<'a, T: YyResource> IntoIterator for &'a YyResourceHandler<T>[src]

type Item = &'a YyResourceData<T>

The type of the elements being iterated over.

type IntoIter = Values<'a, String, YyResourceData<T>>

Which kind of iterator are we turning this into?

impl<T: PartialEq + YyResource> PartialEq<YyResourceHandler<T>> for YyResourceHandler<T>[src]

impl<T: YyResource> StructuralPartialEq for YyResourceHandler<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for YyResourceHandler<T> where
    T: RefUnwindSafe,
    <T as YyResource>::AssociatedData: RefUnwindSafe
[src]

impl<T> Send for YyResourceHandler<T> where
    T: Send,
    <T as YyResource>::AssociatedData: Send
[src]

impl<T> Sync for YyResourceHandler<T> where
    T: Sync,
    <T as YyResource>::AssociatedData: Sync
[src]

impl<T> Unpin for YyResourceHandler<T> where
    T: Unpin,
    <T as YyResource>::AssociatedData: Unpin
[src]

impl<T> UnwindSafe for YyResourceHandler<T> where
    T: UnwindSafe,
    <T as YyResource>::AssociatedData: UnwindSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,