Struct runestick::Ref [−][src]
pub struct Ref<T: ?Sized> { /* fields omitted */ }
Expand description
A strong reference to the given type.
Implementations
Map the interior reference of an owned mutable value.
Examples
use runestick::{Ref, Shared}; let vec = Shared::<Vec<u32>>::new(vec![1, 2, 3, 4]); let vec = vec.into_ref()?; let value: Ref<[u32]> = Ref::map(vec, |vec| &vec[0..2]); assert_eq!(&*value, &[1u32, 2u32][..]);
Try to map the reference to a projection.
Examples
use runestick::{Ref, Shared}; let vec = Shared::<Vec<u32>>::new(vec![1, 2, 3, 4]); let vec = vec.into_ref()?; let value: Option<Ref<[u32]>> = Ref::try_map(vec, |vec| vec.get(0..2)); assert_eq!(value.as_deref(), Some(&[1u32, 2u32][..]));
Trait Implementations
Try to convert to the given type, from the given value.
Try to convert to the given type, from the given value.
Try to convert to the given type, from the given value.
Try to convert to the given type, from the given value.
Try to convert to the given type, from the given value.
Try to convert to the given type, from the given value.
Try to convert to the given type, from the given value.