Struct webrender::intern::Interner

source ·
pub struct Interner<I: Internable> {
    map: FastHashMap<I::Key, ItemDetails<I>>,
    free_list: Vec<usize>,
    update_list: UpdateList<I::Key>,
    current_epoch: Epoch,
    local_data: Vec<I::InternData>,
}
Expand description

The main interning data structure. This lives in the scene builder thread, and handles hashing and interning unique data structures. It also manages a free-list for the items in the data store, which is synchronized via an update list of additions / removals.

Fields§

§map: FastHashMap<I::Key, ItemDetails<I>>

Uniquely map an interning key to a handle

§free_list: Vec<usize>

List of free slots in the data store for re-use.

§update_list: UpdateList<I::Key>

Pending list of updates that need to be applied.

§current_epoch: Epoch

The current epoch for the interner.

§local_data: Vec<I::InternData>

The information associated with each interned item that can be accessed by the interner.

Implementations§

source§

impl<I: Internable> Interner<I>

source

pub fn intern<F>(&mut self, data: &I::Key, fun: F) -> Handle<I>where F: FnOnce() -> I::InternData,

Intern a data structure, and return a handle to that data. The handle can then be stored in the frame builder, and safely accessed via the data store that lives in the frame builder thread. The provided closure is invoked to build the local data about an interned structure if the key isn’t already interned.

source

pub fn end_frame_and_get_pending_updates(&mut self) -> UpdateList<I::Key>

Retrieve the pending list of updates for an interner that need to be applied to the data store. Also run a GC step that removes old entries.

Trait Implementations§

source§

impl AsMut<Interner<BackdropCapture>> for Interners

source§

fn as_mut(&mut self) -> &mut Interner<BackdropCapture>

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

impl AsMut<Interner<BackdropRender>> for Interners

source§

fn as_mut(&mut self) -> &mut Interner<BackdropRender>

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

impl AsMut<Interner<ClipIntern>> for Interners

source§

fn as_mut(&mut self) -> &mut Interner<ClipIntern>

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

impl AsMut<Interner<ConicGradient>> for Interners

source§

fn as_mut(&mut self) -> &mut Interner<ConicGradient>

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

impl AsMut<Interner<FilterDataIntern>> for Interners

source§

fn as_mut(&mut self) -> &mut Interner<FilterDataIntern>

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

impl AsMut<Interner<Image>> for Interners

source§

fn as_mut(&mut self) -> &mut Interner<Image>

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

impl AsMut<Interner<ImageBorder>> for Interners

source§

fn as_mut(&mut self) -> &mut Interner<ImageBorder>

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

impl AsMut<Interner<LineDecoration>> for Interners

source§

fn as_mut(&mut self) -> &mut Interner<LineDecoration>

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

impl AsMut<Interner<LinearGradient>> for Interners

source§

fn as_mut(&mut self) -> &mut Interner<LinearGradient>

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

impl AsMut<Interner<NormalBorderPrim>> for Interners

source§

fn as_mut(&mut self) -> &mut Interner<NormalBorderPrim>

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

impl AsMut<Interner<Picture>> for Interners

source§

fn as_mut(&mut self) -> &mut Interner<Picture>

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

impl AsMut<Interner<PolygonIntern>> for Interners

source§

fn as_mut(&mut self) -> &mut Interner<PolygonIntern>

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

impl AsMut<Interner<PrimitiveKeyKind>> for Interners

source§

fn as_mut(&mut self) -> &mut Interner<PrimitiveKeyKind>

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

impl AsMut<Interner<RadialGradient>> for Interners

source§

fn as_mut(&mut self) -> &mut Interner<RadialGradient>

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

impl AsMut<Interner<TextRun>> for Interners

source§

fn as_mut(&mut self) -> &mut Interner<TextRun>

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

impl AsMut<Interner<YuvImage>> for Interners

source§

fn as_mut(&mut self) -> &mut Interner<YuvImage>

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

impl<I: Internable> Default for Interner<I>

source§

fn default() -> Self

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

impl<I: Internable> Index<Handle<I>> for Interner<I>

Retrieve the local data for an item from the interner via handle

§

type Output = <I as Internable>::InternData

The returned type after indexing.
source§

fn index(&self, handle: Handle<I>) -> &I::InternData

Performs the indexing (container[index]) operation. Read more
source§

impl<I> MallocSizeOf for Interner<I>where I: MallocSizeOf + Internable,

source§

fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize

Measure the heap usage of all descendant heap-allocated structures, but not the space taken up by the value itself.
source§

impl<I> Serialize for Interner<I>where I: Serialize + Internable,

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl<I> RefUnwindSafe for Interner<I>where I: RefUnwindSafe, <I as Internable>::InternData: RefUnwindSafe, <I as Internable>::Key: RefUnwindSafe,

§

impl<I> Send for Interner<I>where I: Send, <I as Internable>::InternData: Send, <I as Internable>::Key: Send,

§

impl<I> Sync for Interner<I>where I: Sync, <I as Internable>::InternData: Sync, <I as Internable>::Key: Sync,

§

impl<I> Unpin for Interner<I>where I: Unpin, <I as Internable>::InternData: Unpin, <I as Internable>::Key: Unpin,

§

impl<I> UnwindSafe for Interner<I>where I: UnwindSafe, <I as Internable>::InternData: UnwindSafe, <I as Internable>::Key: UnwindSafe,

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

source§

fn from(t: T) -> T

Returns the argument unchanged.

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

source§

const ALIGN: usize = _

The alignment of pointer.
§

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, 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.