Struct floem_peniko::Blob

source ·
pub struct Blob<T> { /* private fields */ }
Expand description

Shared data with an associated unique identifier.

Implementations§

source§

impl<T> Blob<T>

source

pub fn new(data: Arc<dyn AsRef<[T]> + Send + Sync>) -> Self

Creates a new blob from the given data and generates a unique identifier.

source

pub fn from_raw_parts(data: Arc<dyn AsRef<[T]> + Send + Sync>, id: u64) -> Self

Creates a new blob from the given data and identifier.

Note that while this function is not unsafe, usage of this in combination with new (or with identifiers that are not uniquely associated with the given data) can lead to inconsistencies.

This is primarily for libraries that wish to interop with vello but are unable to depend on our resource types.

source

pub fn into_raw_parts(self) -> (Arc<dyn AsRef<[T]> + Send + Sync>, u64)

Consumes self and returns the inner components of the blob.

source

pub fn len(&self) -> usize

Returns the length of the data.

source

pub fn is_empty(&self) -> bool

Returns true if the blob is empty.

source

pub fn data(&self) -> &[T]

Returns a reference to the underlying data.

source

pub fn id(&self) -> u64

Returns the unique identifier associated with the data.

source

pub fn downgrade(&self) -> WeakBlob<T>

Downgrades the shared blob to a weak reference.

Trait Implementations§

source§

impl<T> AsRef<[T]> for Blob<T>

source§

fn as_ref(&self) -> &[T]

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

impl<T> Clone for Blob<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> Debug for Blob<T>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T> From<Vec<T>> for Blob<T>
where T: 'static + Send + Sync,

source§

fn from(vec: Vec<T>) -> Self

Converts to this type from the input type.
source§

impl<T> PartialEq for Blob<T>

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

§

impl<T> !RefUnwindSafe for Blob<T>

§

impl<T> Send for Blob<T>

§

impl<T> Sync for Blob<T>

§

impl<T> Unpin for Blob<T>

§

impl<T> !UnwindSafe for Blob<T>

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

source§

fn from(t: T) -> T

Returns the argument unchanged.

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> ToOwned for T
where 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 T
where 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 T
where 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.