[][src]Struct reffers::aref::ARefss

#[repr(C)]
pub struct ARefss<'a, U: ?Sized>(_);

ARefss is a version of ARef that implements Send + Sync.

It works just like ARef, except that its owner must implement Send + Sync, and thus the struct implements Send + Sync as well.

Methods

impl<'a, U: ?Sized> ARefss<'a, U>[src]

pub fn new<O>(owner: O) -> Self where
    O: 'a + AReffic + Send + Sync + Deref<Target = U>, 
[src]

Creates a new ARefss from what the ARefss points to.

Example

use reffers::ARefss;

let aref = ARefss::new(Box::new(43));
assert_eq!(*aref, 43);

pub fn map<V: ?Sized, F: FnOnce(&U) -> &V>(self, f: F) -> ARefss<'a, V>[src]

Maps the ARefss' target to something reachable from the target.

Example

use reffers::ARefss;

let aref: ARefss<[u8]> = vec![0u8, 5, 7].into();
assert_eq!(*aref.map(|s| &s[1]), 5);

pub fn try_map<E, V: ?Sized, F: FnOnce(&U) -> Result<&V, E>>(
    self,
    f: F
) -> Result<ARefss<'a, V>, E>
[src]

Like map, but with Result passthrough.

Example

use reffers::ARefss;

let aref = ARefss::<[u8]>::from(vec![0u8, 5, 7]);
assert_eq!(aref.try_map(|s| s.get(9).ok_or(())), Err(()));

pub fn into_aref(self) -> ARef<'a, U>[src]

Removes the type information that this struct is Send + Sync.

pub fn into_arefs(self) -> ARefs<'a, U>[src]

Removes the type information that this struct is Sync.

Trait Implementations

impl<'a, U: ?Sized> Send for ARefss<'a, U>[src]

impl<'a, U: ?Sized> Sync for ARefss<'a, U>[src]

impl<'a, U: ?Sized> AsRef<U> for ARefss<'a, U>[src]

impl<'a, O: 'a + AReffic + Send + Sync + Deref<Target = U>, U: ?Sized> From<O> for ARefss<'a, U>[src]

impl<'a, U: ?Sized + Eq> Eq for ARefss<'a, U>[src]

impl<'a, U: ?Sized + Ord> Ord for ARefss<'a, U>[src]

impl<'a, U: ?Sized + PartialEq> PartialEq<ARefss<'a, U>> for ARefss<'a, U>[src]

impl<'a, U: ?Sized + PartialOrd> PartialOrd<ARefss<'a, U>> for ARefss<'a, U>[src]

impl<'a, U: Debug + ?Sized> Debug for ARefss<'a, U>[src]

impl<'a, U: ?Sized> Deref for ARefss<'a, U>[src]

type Target = U

The resulting type after dereferencing.

impl<'a, U: ?Sized + Hash> Hash for ARefss<'a, U>[src]

impl<'a, U: ?Sized> Borrow<U> for ARefss<'a, U>[src]

Auto Trait Implementations

impl<'a, U: ?Sized> Unpin for ARefss<'a, U>

impl<'a, U: ?Sized> UnwindSafe for ARefss<'a, U> where
    U: RefUnwindSafe

impl<'a, U> !RefUnwindSafe for ARefss<'a, U>

Blanket Implementations

impl<T> Repr for T[src]

type Store = T

impl<T> Repr for T[src]

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

impl<T> From<T> for 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<T> Borrow<T> for T where
    T: ?Sized
[src]

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

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