Struct style::properties::BuilderArc
source · pub struct BuilderArc<T>where
T: ?Sized,{
pub(crate) p: NonNull<ArcInner<T>>,
pub(crate) phantom: PhantomData<T>,
}
Expand description
An atomically reference counted shared pointer
See the documentation for Arc
in the standard library. Unlike the
standard library Arc
, this Arc
does not support weak reference counting.
See the discussion in https://github.com/rust-lang/rust/pull/60594 for the usage of PhantomData.
cbindgen:derive-eq=false cbindgen:derive-neq=false
Fields§
§p: NonNull<ArcInner<T>>
§phantom: PhantomData<T>
Implementations§
source§impl<T> Arc<T>
impl<T> Arc<T>
sourcepub fn new_leaked(data: T) -> Arc<T>
pub fn new_leaked(data: T) -> Arc<T>
Construct an intentionally-leaked arc.
sourcepub unsafe fn from_raw_addrefed(ptr: *const T) -> Arc<T>
pub unsafe fn from_raw_addrefed(ptr: *const T) -> Arc<T>
Like from_raw, but returns an addrefed arc instead.
sourcepub unsafe fn new_static<F>(alloc: F, data: T) -> Arc<T>where
F: FnOnce(Layout) -> *mut u8,
pub unsafe fn new_static<F>(alloc: F, data: T) -> Arc<T>where
F: FnOnce(Layout) -> *mut u8,
Create a new static Arcalloc
function.
alloc
must return a pointer into a static allocation suitable for
storing data with the Layout
passed into it. The pointer returned by
alloc
will not be freed.
sourcepub fn borrow_arc<'a>(&'a self) -> ArcBorrow<'a, T>
pub fn borrow_arc<'a>(&'a self) -> ArcBorrow<'a, T>
Produce a pointer to the data that can be converted back
to an Arc. This is basically an &Arc<T>
, without the extra indirection.
It has the benefits of an &T
but also knows about the underlying refcount
and can be converted into more Arc<T>
s if necessary.
sourcepub fn with_raw_offset_arc<F, U>(&self, f: F) -> Uwhere
F: FnOnce(&RawOffsetArc<T>) -> U,
pub fn with_raw_offset_arc<F, U>(&self, f: F) -> Uwhere
F: FnOnce(&RawOffsetArc<T>) -> U,
Temporarily converts |self| into a bonafide RawOffsetArc and exposes it to the provided callback. The refcount is not modified.
source§impl<T> Arc<T>where
T: ?Sized,
impl<T> Arc<T>where
T: ?Sized,
sourcepub fn mark_as_intentionally_leaked(&self)
pub fn mark_as_intentionally_leaked(&self)
Marks this Arc
as intentionally leaked for the purposes of refcount
logging.
It’s a logic error to call this more than once, but it’s not unsafe, as it’d just report negative leaks.
source§impl<T> Arc<T>where
T: Clone,
impl<T> Arc<T>where
T: Clone,
sourcepub fn make_mut(this: &mut Arc<T>) -> &mut T
pub fn make_mut(this: &mut Arc<T>) -> &mut T
Makes a mutable reference to the Arc
, cloning if necessary
This is functionally equivalent to Arc::make_mut
from the standard library.
If this Arc
is uniquely owned, make_mut()
will provide a mutable
reference to the contents. If not, make_mut()
will create a new Arc
with a copy of the contents, update this
to point to it, and provide
a mutable reference to its contents.
This is useful for implementing copy-on-write schemes where you wish to
avoid copying things if your Arc
is not shared.
source§impl<T> Arc<T>where
T: ?Sized,
impl<T> Arc<T>where
T: ?Sized,
source§impl<H, T> Arc<HeaderSlice<H, [T]>>
impl<H, T> Arc<HeaderSlice<H, [T]>>
sourcepub fn from_header_and_iter<I>(header: H, items: I) -> Arc<HeaderSlice<H, [T]>>where
I: Iterator<Item = T> + ExactSizeIterator,
pub fn from_header_and_iter<I>(header: H, items: I) -> Arc<HeaderSlice<H, [T]>>where
I: Iterator<Item = T> + ExactSizeIterator,
Creates an Arc for a HeaderSlice using the given header struct and iterator to generate the slice. The resulting Arc will be fat.
source§impl<H, T> Arc<HeaderSlice<HeaderWithLength<H>, [T]>>
impl<H, T> Arc<HeaderSlice<HeaderWithLength<H>, [T]>>
sourcepub fn into_thin(a: Arc<HeaderSlice<HeaderWithLength<H>, [T]>>) -> ThinArc<H, T>
pub fn into_thin(a: Arc<HeaderSlice<HeaderWithLength<H>, [T]>>) -> ThinArc<H, T>
Converts an Arc
into a ThinArc
. This consumes the Arc
, so the refcount
is not modified.
sourcepub fn from_thin(a: ThinArc<H, T>) -> Arc<HeaderSlice<HeaderWithLength<H>, [T]>>
pub fn from_thin(a: ThinArc<H, T>) -> Arc<HeaderSlice<HeaderWithLength<H>, [T]>>
Converts a ThinArc
into an Arc
. This consumes the ThinArc
, so the refcount
is not modified.
source§impl<T> Arc<T>
impl<T> Arc<T>
sourcepub fn into_raw_offset(a: Arc<T>) -> RawOffsetArc<T>
pub fn into_raw_offset(a: Arc<T>) -> RawOffsetArc<T>
Converts an Arc
into a RawOffsetArc
. This consumes the Arc
, so the refcount
is not modified.
sourcepub fn from_raw_offset(a: RawOffsetArc<T>) -> Arc<T>
pub fn from_raw_offset(a: RawOffsetArc<T>) -> Arc<T>
Converts a RawOffsetArc
into an Arc
. This consumes the RawOffsetArc
, so the refcount
is not modified.
Trait Implementations§
source§impl<'de, T> Deserialize<'de> for Arc<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for Arc<T>where
T: Deserialize<'de>,
source§fn deserialize<D>(
deserializer: D
) -> Result<Arc<T>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D
) -> Result<Arc<T>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
source§impl<T> MallocConditionalShallowSizeOf for Arc<T>
impl<T> MallocConditionalShallowSizeOf for Arc<T>
source§fn conditional_shallow_size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn conditional_shallow_size_of(&self, ops: &mut MallocSizeOfOps) -> usize
conditional_size_of
combined with shallow_size_of
.source§impl<T> MallocConditionalSizeOf for Arc<T>where
T: MallocSizeOf,
impl<T> MallocConditionalSizeOf for Arc<T>where
T: MallocSizeOf,
source§fn conditional_size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn conditional_size_of(&self, ops: &mut MallocSizeOfOps) -> usize
source§impl<T> MallocUnconditionalShallowSizeOf for Arc<T>
impl<T> MallocUnconditionalShallowSizeOf for Arc<T>
source§fn unconditional_shallow_size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn unconditional_shallow_size_of(&self, ops: &mut MallocSizeOfOps) -> usize
unconditional_size_of
combined with shallow_size_of
.source§impl<T> MallocUnconditionalSizeOf for Arc<T>where
T: MallocSizeOf,
impl<T> MallocUnconditionalSizeOf for Arc<T>where
T: MallocSizeOf,
source§fn unconditional_size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn unconditional_size_of(&self, ops: &mut MallocSizeOfOps) -> usize
source§impl<T> Ord for Arc<T>where
T: Ord + ?Sized,
impl<T> Ord for Arc<T>where
T: Ord + ?Sized,
source§impl<T> PartialOrd<Arc<T>> for Arc<T>where
T: PartialOrd<T> + ?Sized,
impl<T> PartialOrd<Arc<T>> for Arc<T>where
T: PartialOrd<T> + ?Sized,
source§impl<T> Serialize for Arc<T>where
T: Serialize,
impl<T> Serialize for Arc<T>where
T: Serialize,
source§fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
source§impl<T> SpecifiedValueInfo for Arc<T>where
T: SpecifiedValueInfo,
impl<T> SpecifiedValueInfo for Arc<T>where
T: SpecifiedValueInfo,
source§const SUPPORTED_TYPES: u8 = T::SUPPORTED_TYPES
const SUPPORTED_TYPES: u8 = T::SUPPORTED_TYPES
source§impl<T> ToComputedValue for Arc<T>where
T: ToComputedValue<ComputedValue = T>,
impl<T> ToComputedValue for Arc<T>where
T: ToComputedValue<ComputedValue = T>,
§type ComputedValue = Arc<T>
type ComputedValue = Arc<T>
source§fn to_computed_value(&self, _: &Context<'_>) -> Self
fn to_computed_value(&self, _: &Context<'_>) -> Self
Context
.source§fn from_computed_value(computed: &Self) -> Self
fn from_computed_value(computed: &Self) -> Self
source§impl<T> ToResolvedValue for Arc<T>where
T: ToResolvedValue<ResolvedValue = T>,
impl<T> ToResolvedValue for Arc<T>where
T: ToResolvedValue<ResolvedValue = T>,
§type ResolvedValue = Arc<T>
type ResolvedValue = Arc<T>
source§fn to_resolved_value(self, _: &Context<'_>) -> Self
fn to_resolved_value(self, _: &Context<'_>) -> Self
source§fn from_resolved_value(resolved: Self) -> Self
fn from_resolved_value(resolved: Self) -> Self
source§impl<T> ToShmem for Arc<T>where
T: 'static + ToShmem,
impl<T> ToShmem for Arc<T>where
T: 'static + ToShmem,
source§fn to_shmem(
&self,
builder: &mut SharedMemoryBuilder
) -> Result<ManuallyDrop<Arc<T>>, String>
fn to_shmem(
&self,
builder: &mut SharedMemoryBuilder
) -> Result<ManuallyDrop<Arc<T>>, String>
impl<T> CloneStableDeref for Arc<T>where
T: ?Sized,
impl<T> Eq for Arc<T>where
T: Eq + ?Sized,
impl<T> Send for Arc<T>where
T: Sync + Send + ?Sized,
impl<T> StableDeref for Arc<T>where
T: ?Sized,
impl<T> Sync for Arc<T>where
T: Sync + Send + ?Sized,
Auto Trait Implementations§
impl<T: ?Sized> RefUnwindSafe for Arc<T>where
T: RefUnwindSafe,
impl<T: ?Sized> Unpin for Arc<T>where
T: Unpin,
impl<T: ?Sized> UnwindSafe for Arc<T>where
T: UnwindSafe + RefUnwindSafe,
Blanket Implementations§
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.