ArcWrapper

Struct ArcWrapper 

Source
pub struct ArcWrapper<T: ArcWrapperBounds> {
    pub data: Arc<T>,
    pub store_path: Option<PathBuf>,
    /* private fields */
}
Expand description

Implementing encapsulation of Arc to enable third-party Trait HeapSize implementation for the Arc type Because of use Arc in LruCache, the LruCache is not clear whether a pointer will drop the referenced content when it is ejected from the cache, the actual memory usage is not accurate

Fields§

§data: Arc<T>§store_path: Option<PathBuf>

Implementations§

Source§

impl<T: ArcWrapperBounds> ArcWrapper<T>

Source

pub fn new( data: Arc<T>, share_flag: Arc<AtomicBool>, pool: Option<Arc<ThreadPool>>, ) -> Self

Create a new ArcWrapper

Source

pub fn set_store_path(&mut self, path: PathBuf)

Trait Implementations§

Source§

impl<T: ArcWrapperBounds> Clone for ArcWrapper<T>

Source§

fn clone(&self) -> Self

clone won’t clone the store_path

1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<T: ArcWrapperBounds> Deref for ArcWrapper<T>

Source§

type Target = Arc<T>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<T: ArcWrapperBounds> Drop for ArcWrapper<T>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<T: ArcWrapperBounds> HeapSize for ArcWrapper<T>

Source§

fn heap_size(&self) -> usize

The size of the referenced data that is owned by this value in bytes, usually allocated on the heap (such as the value of a Box or the elements and reserved memory of a Vec). Read more
Source§

fn heap_size_sum_iter<'item, Fun, Iter>(make_iter: Fun) -> usize
where Self: 'item, Fun: Fn() -> Iter, Iter: Iterator<Item = &'item Self>,

The total sum of the sizes of referenced data that is owned by a value in an iterator constructed with the given constructor, in bytes. This is default-implemented by computing HeapSize::heap_size on every element and summing them. In some cases, specialized implementations may be more performant. This is common for types which do not allocate any memory at all, where this function can be implemented by a constant zero. Read more
Source§

fn heap_size_sum_exact_size_iter<'item, Fun, Iter>(make_iter: Fun) -> usize
where Self: 'item, Fun: Fn() -> Iter, Iter: ExactSizeIterator<Item = &'item Self>,

The total sum of the sizes of referenced data that is owned by a value in an exact-size-iterator constructed with the given constructor, in bytes. This is default-implemented by using HeapSize::heap_size_sum_iter. In some cases, specialized implementations relying on the iterator’s size may be more performant. This is common for types which allocate a constant amount of memory, where this function can multiply the iterator’s length. Read more

Auto Trait Implementations§

§

impl<T> Freeze for ArcWrapper<T>

§

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

§

impl<T> Send for ArcWrapper<T>

§

impl<T> Sync for ArcWrapper<T>

§

impl<T> Unpin for ArcWrapper<T>

§

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

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> MemSize for T
where T: HeapSize + ValueSize + ?Sized,

Source§

fn mem_size(&self) -> usize

The total size of this value in bytes. This includes the value itself as well as all owned referenced data (such as the value on the heap of a Box or the elements and reserved memory of a Vec). Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

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 T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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> ValueSize for T

Source§

fn value_size(&self) -> usize

The size of this value in bytes, excluding allocated data. Read more
Source§

fn value_size_sum_iter<'item>(iterator: impl Iterator<Item = &'item T>) -> usize
where T: 'item,

The total sum of the sizes of all values in the given iterator, in bytes. This is default-implemented by computing ValueSize::value_size on every element and summing them. For Sized types, a more potentially efficient implementation using Iterator::count is provided. If you are implementing this trait manually, it is unlikely to be more efficient to provide a manual implementation here. Read more
Source§

fn value_size_sum_exact_size_iter<'item>( iterator: impl ExactSizeIterator<Item = &'item T>, ) -> usize
where T: 'item,

The total sum of the sizes of all values in the given exact-size-iterator, in bytes. This is default-implemented by using ValueSize::value_size_sum_iter. For Sized types, a usually more efficient implementation using ExactSizeIterator::len is provided. If you are implementing this trait manually, it is unlikely to be more efficient to provide a manual implementation here. Read more
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,