Type Alias freya_engine::prelude::Data

pub type Data = RCHandle<SkData>;

Aliased Type§

struct Data(/* private fields */);

Implementations

§

impl RCHandle<SkData>

pub fn size(&self) -> usize

pub fn is_empty(&self) -> bool

pub fn as_bytes(&self) -> &[u8]

pub fn copy_range(&self, offset: usize, buffer: &mut [u8]) -> &RCHandle<SkData>

pub fn new_copy(data: &[u8]) -> RCHandle<SkData>

pub unsafe fn new_bytes(data: &[u8]) -> RCHandle<SkData>

Constructs Data from a given byte slice without copying it.

Users must make sure that the underlying slice will outlive the lifetime of the Data.

pub unsafe fn new_uninitialized(length: usize) -> RCHandle<SkData>

pub fn new_zero_initialized(length: usize) -> RCHandle<SkData>

pub fn new_subset( data: &RCHandle<SkData>, offset: usize, length: usize, ) -> RCHandle<SkData>

pub fn new_str(str: impl AsRef<str>) -> RCHandle<SkData>

Constructs Data from a copy of a &str.

Functions that use Data as a string container usually expect it to contain a c-string including the terminating 0 byte, so this function converts the Rust str to a CString and calls [Self::new_cstr()].

pub fn new_cstr(cstr: &CStr) -> RCHandle<SkData>

Constructs Data from a &CStr by copying its contents.

pub fn from_filename(path: impl AsRef<Path>) -> Option<RCHandle<SkData>>

Create a new Data referencing the file with the specified path. If the file cannot be opened, the path contains 0 bytes, or the path is not valid UTF-8, this returns None.

This function opens the file as a memory mapped file for the lifetime of Data returned.

pub fn from_stream(stream: impl Read, size: usize) -> Option<RCHandle<SkData>>

Attempt to read size bytes into a Data. If the read succeeds, return the data, else return None. Either way the stream’s cursor may have been changed as a result of calling read().

pub fn new_empty() -> RCHandle<SkData>

§

impl<T> RCHandle<T>
where T: NativeRefCounted + NodeSubtype,

pub fn as_base(&self) -> &RCHandle<<T as NodeSubtype>::Base>

pub fn as_base_mut(&mut self) -> &mut RCHandle<<T as NodeSubtype>::Base>

pub fn into_node(self) -> RCHandle<SkSVGNode>

All concrete node types can be converted to the supertype Node.

pub fn typed(self) -> TypedNode

All concrete node types can be converted to a TypedNode

Trait Implementations

§

impl<N> AsRef<RCHandle<N>> for RCHandle<N>
where N: NativeRefCounted,

§

fn as_ref(&self) -> &RCHandle<N>

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

impl<N> Clone for RCHandle<N>
where N: NativeRefCounted,

§

fn clone(&self) -> RCHandle<N>

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
§

impl<H> ConditionallySend for RCHandle<H>
where H: NativeRefCountedBase,

RCHandle<H> is conditionally Send and can be sent to another thread when its reference count is 1.

§

fn can_send(&self) -> bool

Returns true if the handle can be sent to another thread.
§

fn wrap_send(self) -> Result<Sendable<RCHandle<H>>, RCHandle<H>>

Wrap the handle in a type that can be sent to another thread and unwrapped there. Read more
§

impl<N> Debug for RCHandle<N>
where N: NativeRefCounted, RCHandle<N>: DebugAttributes,

§

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

Formats the value using the given formatter. Read more
§

impl Debug for RCHandle<SkData>

§

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

Formats the value using the given formatter. Read more
§

impl Deref for RCHandle<SkData>

§

type Target = [u8]

The resulting type after dereferencing.
§

fn deref(&self) -> &<RCHandle<SkData> as Deref>::Target

Dereferences the value.
§

impl<T> Deref for RCHandle<T>
where T: NativeRefCounted + NodeSubtype,

§

type Target = RCHandle<<T as NodeSubtype>::Base>

The resulting type after dereferencing.
§

fn deref(&self) -> &<RCHandle<T> as Deref>::Target

Dereferences the value.
§

impl<T> DerefMut for RCHandle<T>
where T: NativeRefCounted + NodeSubtype,

This implementation of DerefMut causes subsequent UB when the containing [RCHandle] gets overwritten by a base type that does not match the actual underlying type.

§

fn deref_mut(&mut self) -> &mut <RCHandle<T> as Deref>::Target

Mutably dereferences the value.
§

impl<N> Drop for RCHandle<N>
where N: NativeRefCounted,

§

fn drop(&mut self)

Executes the destructor for this type. Read more
§

impl<N> Flattenable for RCHandle<N>
where N: NativeFlattenable + NativeRefCountedBase,

§

fn type_name(&self) -> &CStr

§

fn serialize(&self) -> RCHandle<SkData>

§

fn deserialize(data: &[u8]) -> Option<RCHandle<N>>

§

impl<N> From<&RCHandle<N>> for RCHandle<N>
where N: NativeRefCounted,

A reference counted handle is cheap to clone, so we do support a conversion from a reference to a ref counter to an owned handle.

§

fn from(rch: &RCHandle<N>) -> RCHandle<N>

Converts to this type from the input type.
§

impl<N> PartialEq for RCHandle<N>
where N: NativeRefCounted + NativePartialEq,

§

fn eq(&self, rhs: &RCHandle<N>) -> bool

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

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

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

impl PartialEq for RCHandle<SkData>

§

fn eq(&self, other: &RCHandle<SkData>) -> bool

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

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

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

impl<N> PointerWrapper<N> for RCHandle<N>
where N: NativeRefCounted,

§

fn wrap(ptr: *mut N) -> Option<RCHandle<N>>

Wraps a native pointer into a wrapper type. Returns None if the pointer is null.
§

fn unwrap(self) -> *mut N

Unwraps the wrapper type into the native pointer.
§

fn inner(&self) -> &N

Access the wrapped pointer.
§

fn inner_mut(&mut self) -> &mut N

Access the wrapped pointer.
§

impl Send for RCHandle<SkData>

§

impl Sync for RCHandle<SkData>