pub struct Arc<T>where
T: ?Sized,{ /* private fields */ }Expand description
Arc wrapper used by Stylo. 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
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 fn into_raw(this: Arc<T>) -> *const T
pub fn into_raw(this: Arc<T>) -> *const T
Convert the Arc
Note: This returns a pointer to the data T, which is offset in the allocation.
Sourcepub unsafe fn from_raw(ptr: *const T) -> Arc<T>
pub unsafe fn from_raw(ptr: *const T) -> Arc<T>
Reconstruct the Arc
Note: This raw pointer will be offset in the allocation and must be preceded by the atomic count.
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>
pub unsafe fn new_static<F>(alloc: F, data: T) -> Arc<T>
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.
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_alloc<F, I>(
alloc: F,
header: H,
items: I,
num_items: usize,
is_static: bool,
) -> Arc<HeaderSlice<H, T>>
pub fn from_header_and_iter_alloc<F, I>( alloc: F, header: H, items: I, num_items: usize, is_static: bool, ) -> Arc<HeaderSlice<H, T>>
Creates an Arc for a HeaderSlice using the given header struct and iterator to generate the slice.
is_static indicates whether to create a static Arc.
alloc is used to get a pointer to the memory into which the
dynamically sized ArcInner<HeaderSlice<H, T>> value will be
written. If is_static is true, then alloc must return a
pointer into some static memory allocation. If it is false,
then alloc must return an allocation that can be dellocated
by calling Box::from_raw::<ArcInner<HeaderSlice<H, T>>> on it.
Sourcepub fn from_header_and_iter_with_size<I>(
header: H,
items: I,
num_items: usize,
) -> Arc<HeaderSlice<H, T>>where
I: Iterator<Item = T>,
pub fn from_header_and_iter_with_size<I>(
header: H,
items: I,
num_items: usize,
) -> Arc<HeaderSlice<H, T>>where
I: Iterator<Item = T>,
Creates an Arc for a HeaderSlice using the given header struct and iterator to generate the slice. Panics if num_items doesn’t match the number of items.
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.
Trait Implementations§
Source§impl<'de, T> Deserialize<'de> for Arc<T>where
T: Deserialize<'de>,
Available on crate feature servo only.
impl<'de, T> Deserialize<'de> for Arc<T>where
T: Deserialize<'de>,
servo only.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>
impl<T> Ord for Arc<T>
Source§impl Parse for Arc<VariableValue>
impl Parse for Arc<VariableValue>
Source§fn parse<'i, 't>(
context: &ParserContext<'_>,
input: &mut Parser<'i, 't>,
) -> Result<Arc<VariableValue>, ParseError<'i, StyleParseErrorKind<'i>>>
fn parse<'i, 't>( context: &ParserContext<'_>, input: &mut Parser<'i, 't>, ) -> Result<Arc<VariableValue>, ParseError<'i, StyleParseErrorKind<'i>>>
Source§impl<T> PartialOrd for Arc<T>where
T: PartialOrd + ?Sized,
impl<T> PartialOrd for Arc<T>where
T: PartialOrd + ?Sized,
Source§impl<T> Serialize for Arc<T>where
T: Serialize,
Available on crate feature servo only.
impl<T> Serialize for Arc<T>where
T: Serialize,
servo only.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>,
Source§type ComputedValue = Arc<T>
type ComputedValue = Arc<T>
Source§fn to_computed_value(&self, _: &Context<'_>) -> Arc<T>
fn to_computed_value(&self, _: &Context<'_>) -> Arc<T>
Context.Source§impl<T> ToCss for Arc<T>
impl<T> ToCss for Arc<T>
Source§fn to_css<W>(&self, dest: &mut CssWriter<'_, W>) -> Result<(), Error>where
W: Write,
fn to_css<W>(&self, dest: &mut CssWriter<'_, W>) -> Result<(), Error>where
W: Write,
self in CSS syntax, writing to dest.Source§fn to_css_string(&self) -> String
fn to_css_string(&self) -> String
self in CSS syntax and return a string. Read moreSource§fn to_css_cssstring(&self) -> String
fn to_css_cssstring(&self) -> String
self in CSS syntax and return a CssString. Read moreSource§impl<T> ToResolvedValue for Arc<T>where
T: ToResolvedValue<ResolvedValue = T>,
impl<T> ToResolvedValue for Arc<T>where
T: ToResolvedValue<ResolvedValue = T>,
Source§type ResolvedValue = Arc<T>
type ResolvedValue = Arc<T>
Source§fn to_resolved_value(self, _: &Context<'_>) -> Arc<T>
fn to_resolved_value(self, _: &Context<'_>) -> Arc<T>
Source§fn from_resolved_value(resolved: Arc<T>) -> Arc<T>
fn from_resolved_value(resolved: Arc<T>) -> Arc<T>
Source§impl<H, T> ToShmem for Arc<HeaderSlice<H, T>>
Available on crate feature servo_arc only.
impl<H, T> ToShmem for Arc<HeaderSlice<H, T>>
servo_arc only.Source§fn to_shmem(
&self,
builder: &mut SharedMemoryBuilder,
) -> Result<ManuallyDrop<Arc<HeaderSlice<H, T>>>, String>
fn to_shmem( &self, builder: &mut SharedMemoryBuilder, ) -> Result<ManuallyDrop<Arc<HeaderSlice<H, T>>>, String>
Source§impl<T> ToShmem for Arc<T>where
T: ToShmem,
Available on crate feature servo_arc only.
impl<T> ToShmem for Arc<T>where
T: ToShmem,
servo_arc only.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>
impl<T> Send for Arc<T>
impl<T> StableDeref for Arc<T>where
T: ?Sized,
impl<T> Sync for Arc<T>
Auto Trait Implementations§
impl<T> Freeze for Arc<T>where
T: ?Sized,
impl<T> RefUnwindSafe for Arc<T>where
T: RefUnwindSafe + ?Sized,
impl<T> Unpin for Arc<T>
impl<T> UnsafeUnpin for Arc<T>where
T: ?Sized,
impl<T> UnwindSafe for Arc<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more