ygleam/y

Types

pub type AbstractType
pub type Array
pub type Doc
pub type Map
pub type Text
pub type Transaction

The Value type represents the JavaScript types Yjs can hold:

  • null
  • String
  • Boolean
  • Number
  • Uint8Array
  • Array
  • Object<String, Value>
  • Any Yjs type
pub type Value
pub type XmlElement
pub type XmlFragment

Functions

pub fn array(input: Array) -> Value

Encodes a Yjs Array to a y.Value

pub fn bit_array(input: BitArray) -> Value

Encodes a BitArray to a y.Value

pub fn bool(input: Bool) -> Value

Encodes a Bool to a y.Value

pub fn dict(
  dict: Dict(a, b),
  keys: fn(a) -> String,
  values: fn(b) -> Value,
) -> Value

Encode a Dict into a JSON object using the supplied functions to encode the keys and the values respectively.

pub fn float(input: Float) -> Value

Encodes a Float to a y.Value

pub fn from_json(from: Json) -> Value
pub fn int(input: Int) -> Value

Encodes an Int to a y.Value

pub fn js_array(
  from entries: List(a),
  of inner_type: fn(a) -> Value,
) -> Value

Encode a list into a JS array.

pub fn map(input: Map) -> Value

Encodes a Yjs Map to a y.Value

pub fn null() -> Value

Creates a null y.Value

pub fn nullable(
  from input: Option(a),
  of inner_type: fn(a) -> Value,
) -> Value

Encodes an optional value into a y.Value, using null if None

pub fn object(entries: List(#(String, Value))) -> Value

Encode a list of key-value pairs into a JSON object.

pub fn preprocessed_js_array(from: List(Value)) -> Value
pub fn string(input: String) -> Value

Encodes a String to a y.Value

pub fn text(input: Text) -> Value

Encodes a Yjs Text to a y.Value

pub fn xml_element(input: XmlElement) -> Value

Encodes a Yjs XmlElement to a y.Value

pub fn xml_fragment(input: XmlFragment) -> Value

Encodes a Yjs XmlFragment to a y.Value

Search Document