Struct yrs::YInput

source ·
#[repr(C)]
pub struct YInput { pub tag: i8, pub len: u32, /* private fields */ }
Expand description

A data structure that is used to pass input values of various types supported by Yrs into a shared document store.

YInput constructor function don’t allocate any resources on their own, neither they take ownership by pointers to memory blocks allocated by user - for this reason once an input cell has been used, its content should be freed by the caller.

Fields§

§tag: i8

Tag describing, which value type is being stored by this input cell. Can be one of:

  • Y_JSON_BOOL for boolean flags.
  • Y_JSON_NUM for 64-bit floating point numbers.
  • Y_JSON_INT for 64-bit signed integers.
  • Y_JSON_STR for null-terminated UTF-8 encoded strings.
  • Y_JSON_BUF for embedded binary data.
  • Y_JSON_ARR for arrays of JSON-like values.
  • Y_JSON_MAP for JSON-like objects build from key-value pairs.
  • Y_JSON_NULL for JSON-like null values.
  • Y_JSON_UNDEF for JSON-like undefined values.
  • Y_ARRAY for cells which contents should be used to initialize a YArray shared type.
  • Y_MAP for cells which contents should be used to initialize a YMap shared type.
  • Y_DOC for cells which contents should be used to nest a YDoc sub-document.
  • Y_WEAK_LINK for cells which contents should be used to nest a YWeakLink sub-document.
§len: u32

Length of the contents stored by current YInput cell.

For Y_JSON_NULL and Y_JSON_UNDEF its equal to 0.

For Y_JSON_ARR, Y_JSON_MAP, Y_ARRAY and Y_MAP it describes a number of passed elements.

For other types it’s always equal to 1.

Trait Implementations§

source§

impl Drop for YInput

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl Prelim for YInput

§

type Return = Unused

Type of a value to be returned as a result of inserting this Prelim type instance. Use Unused if none is necessary.
source§

fn into_content<'doc>( self, _: &mut TransactionMut<'doc> ) -> (ItemContent, Option<Self>)

This method is used to create initial content required in order to create a block item. A supplied ptr can be used to identify block that is about to be created to store the returned content. Read more
source§

fn integrate(self, txn: &mut TransactionMut<'_>, inner_ref: BranchPtr)

Method called once an original item filled with content from Self::into_content has been added to block store. This method is used by complex types such as maps or arrays to append the original contents of prelim struct into YMap, YArray etc.

Auto Trait Implementations§

§

impl Freeze for YInput

§

impl !RefUnwindSafe for YInput

§

impl !Send for YInput

§

impl !Sync for YInput

§

impl Unpin for YInput

§

impl !UnwindSafe for YInput

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