Trait arc_swap::AsRaw[][src]

pub trait AsRaw<T>: Sealed {
    fn as_raw(&self) -> *mut T;
}

A trait describing things that can be turned into a raw pointer.

This is just an abstraction of things that can be passed to the compare_and_swap.

Examples

use std::ptr;
use std::sync::Arc;

use arc_swap::ArcSwapOption;

let a = Arc::new(42);
let shared = ArcSwapOption::from(Some(Arc::clone(&a)));

shared.compare_and_swap(&a, Some(Arc::clone(&a)));
shared.compare_and_swap(&None::<Arc<_>>, Some(Arc::clone(&a)));
shared.compare_and_swap(shared.load(), Some(Arc::clone(&a)));
shared.compare_and_swap(&shared.load(), Some(Arc::clone(&a)));
shared.compare_and_swap(ptr::null(), Some(Arc::clone(&a)));

Required methods

fn as_raw(&self) -> *mut T[src]

Converts the value into a raw pointer.

Loading content...

Implementations on Foreign Types

impl<'a, T: RefCnt> AsRaw<<T as RefCnt>::Base> for &'a T[src]

impl<T> AsRaw<T> for *mut T[src]

impl<T> AsRaw<T> for *const T[src]

Loading content...

Implementors

impl<'a, T: RefCnt> AsRaw<<T as RefCnt>::Base> for &'a Guard<T>[src]

impl<'a, T: RefCnt> AsRaw<<T as RefCnt>::Base> for Guard<T>[src]

Loading content...