Struct cglue::arc::CArc

source ·
#[repr(C)]
pub struct CArc<T: Sized + 'static> { /* private fields */ }
Expand description

FFI-Safe Arc

This is an FFI-Safe equivalent of Arc and Option<Arc>.

Implementations§

source§

impl<T> CArc<T>

source

pub fn take(&mut self) -> CArc<T>

Take arc’s resources, and leave None in its place.

Examples
use cglue::arc::CArc;

let mut arc = CArc::from(0u64);

assert!(arc.as_ref().is_some());

let arc2 = arc.take();

assert!(arc2.as_ref().is_some());
assert!(arc.as_ref().is_none());
source

pub fn transpose(self) -> Option<CArcSome<T>>

Converts CArc<T> into Option<CArcSome<T>>

Examples
use cglue::arc::{CArc, CArcSome};

let mut arc = CArc::from(0u64);

assert!(arc.as_ref().is_some());

let arc2 = arc.transpose();

assert!(arc2.is_some());

Trait Implementations§

source§

impl<T: Sized + 'static> AsRef<Option<&'static T>> for CArc<T>

source§

fn as_ref(&self) -> &Option<&'static T>

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<T> Clone for CArc<T>

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T> Default for CArc<T>

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<T> Drop for CArc<T>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl<T> From<&CArc<T>> for Option<&CArcSome<T>>

source§

fn from(copt: &CArc<T>) -> Self

Converts to this type from the input type.
source§

impl<T> From<&mut CArc<T>> for Option<&mut CArcSome<T>>

source§

fn from(copt: &mut CArc<T>) -> Self

Converts to this type from the input type.
source§

impl<T> From<Arc<T>> for CArc<T>

source§

fn from(arc: Arc<T>) -> Self

Converts to this type from the input type.
source§

impl<T> From<CArc<T>> for Option<CArcSome<T>>

source§

fn from(copt: CArc<T>) -> Self

Converts to this type from the input type.
source§

impl<T> From<Option<Arc<T>>> for CArc<T>

source§

fn from(arc: Option<Arc<T>>) -> Self

Converts to this type from the input type.
source§

impl<T> From<Option<CArcSome<T>>> for CArc<T>

source§

fn from(opt: Option<CArcSome<T>>) -> Self

Converts to this type from the input type.
source§

impl<T> From<T> for CArc<T>

source§

fn from(obj: T) -> Self

Converts to this type from the input type.
source§

impl<T> Opaquable for CArc<T>

§

type OpaqueTarget = CArc<c_void>

source§

fn into_opaque(self) -> Self::OpaqueTarget

Transform self into an opaque version of the trait object. Read more
source§

impl<T: Sync + Send> Send for CArc<T>

source§

impl<T: Sync + Send> Sync for CArc<T>

Auto Trait Implementations§

§

impl<T> RefUnwindSafe for CArc<T>where T: RefUnwindSafe,

§

impl<T> Unpin for CArc<T>

§

impl<T> UnwindSafe for CArc<T>where T: RefUnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<!> for T

source§

fn from(t: !) -> T

Converts to this type from the input type.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, F> From2<T> for Fwhere T: Into<F>,

source§

fn from2(other: T) -> F

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> ContextBounds for Twhere T: 'static + Clone + Send + Sync,

source§

impl<T> GenericTypeBounds for T

source§

impl<T> Opaque for Twhere T: Opaquable<OpaqueTarget = T>,