Struct bones_asset::NetworkHandle
source · pub struct NetworkHandle<T> {
pub cid: Cid,
/* private fields */
}
Expand description
Asset handle that may be replicated over network and converted back into Handle
or UntypedHandle
.
Fields§
§cid: Cid
Content id of the asset, used to lookup asset from AssetServer
.
Implementations§
source§impl<T> NetworkHandle<T>
impl<T> NetworkHandle<T>
sourcepub fn from_cid(cid: Cid) -> Self
pub fn from_cid(cid: Cid) -> Self
Create NetworkHandle
from content id (Cid
).
sourcepub fn into_handle(&self, asset_server: &AssetServer) -> Handle<T>
pub fn into_handle(&self, asset_server: &AssetServer) -> Handle<T>
Create asset Handle
by looking up NetworkHandle
’s Cid
in AssetServer
.
Panics if Cid not found in asset server.
sourcepub fn into_untyped_handle(&self, asset_server: &AssetServer) -> UntypedHandle
pub fn into_untyped_handle(&self, asset_server: &AssetServer) -> UntypedHandle
Convert into UntypedHandle
.
Panics if AssetServer
fails to find handle of asset loaded with Cid
.
Trait Implementations§
source§impl<'de, T> Deserialize<'de> for NetworkHandle<T>
impl<'de, T> Deserialize<'de> for NetworkHandle<T>
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl<T> Freeze for NetworkHandle<T>
impl<T> RefUnwindSafe for NetworkHandle<T>where
T: RefUnwindSafe,
impl<T> Send for NetworkHandle<T>where
T: Send,
impl<T> Sync for NetworkHandle<T>where
T: Sync,
impl<T> Unpin for NetworkHandle<T>where
T: Unpin,
impl<T> UnwindSafe for NetworkHandle<T>where
T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more