Struct yrs::branch::BranchPtr

source ·
pub struct BranchPtr(/* private fields */);
Expand description

A wrapper around Branch cell, supplied with a bunch of convenience methods to operate on both map-like and array-like contents of a Branch.

Methods from Deref<Target = Branch>§

source

pub fn is_deleted(&self) -> bool

source

pub fn id(&self) -> BranchID

source

pub fn as_subdoc(&self) -> Option<Doc>

source

pub fn type_ref(&self) -> &TypeRef

Returns an identifier of an underlying complex data type (eg. is it an Array or a Map).

source

pub fn len(&self) -> u32

Returns a length of an indexed sequence component of a current branch node. Map component elements are computed on demand.

source

pub fn content_len(&self) -> u32

source

pub fn observe<F>(&mut self, f: F) -> Subscription
where F: Fn(&TransactionMut<'_>, &Event) + 'static,

source

pub fn observe_deep<F>(&self, f: F) -> Subscription
where F: Fn(&TransactionMut<'_>, &Events) + 'static,

Trait Implementations§

source§

impl AsMut<Branch> for BranchPtr

source§

fn as_mut(&mut self) -> &mut Branch

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

impl AsRef<Branch> for BranchPtr

source§

fn as_ref(&self) -> &Branch

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

impl Clone for BranchPtr

source§

fn clone(&self) -> BranchPtr

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 Debug for BranchPtr

source§

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

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

impl Deref for BranchPtr

§

type Target = Branch

The resulting type after dereferencing.
source§

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

Dereferences the value.
source§

impl DerefMut for BranchPtr

source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
source§

impl<'a> From<&'a Arc<Branch>> for BranchPtr

source§

fn from(branch: &'a Arc<Branch>) -> Self

Converts to this type from the input type.
source§

impl<'a> From<&'a Branch> for BranchPtr

source§

fn from(branch: &'a Branch) -> Self

Converts to this type from the input type.
source§

impl<'a> From<&'a mut Arc<Branch>> for BranchPtr

source§

fn from(branch: &'a mut Arc<Branch>) -> Self

Converts to this type from the input type.
source§

impl From<BranchPtr> for ArrayRef

source§

fn from(inner: BranchPtr) -> Self

Converts to this type from the input type.
source§

impl From<BranchPtr> for MapRef

source§

fn from(inner: BranchPtr) -> Self

Converts to this type from the input type.
source§

impl From<BranchPtr> for TextRef

source§

fn from(inner: BranchPtr) -> Self

Converts to this type from the input type.
source§

impl From<BranchPtr> for XmlElementRef

source§

fn from(inner: BranchPtr) -> Self

Converts to this type from the input type.
source§

impl From<BranchPtr> for XmlFragmentRef

source§

fn from(inner: BranchPtr) -> Self

Converts to this type from the input type.
source§

impl From<BranchPtr> for XmlHookRef

source§

fn from(inner: BranchPtr) -> Self

Converts to this type from the input type.
source§

impl From<BranchPtr> for XmlTextRef

source§

fn from(inner: BranchPtr) -> Self

Converts to this type from the input type.
source§

impl Hash for BranchPtr

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl Into<Origin> for BranchPtr

source§

fn into(self) -> Origin

Converts this type into the (usually inferred) input type.
source§

impl Into<Value> for BranchPtr

source§

fn into(self) -> Value

Converts current branch data into a Value. It uses a type ref information to resolve, which value variant is a correct one for this branch. Since branch represent only complex types Value::Any will never be returned from this method.

source§

impl PartialEq for BranchPtr

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.
source§

impl TryFrom<BranchPtr> for XmlNode

§

type Error = BranchPtr

The type returned in the event of a conversion error.
source§

fn try_from(value: BranchPtr) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl Copy for BranchPtr

source§

impl Eq for BranchPtr

Auto Trait Implementations§

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.