View Source Yex.DocServer.State (y_ex v0.7.2)

Provides the State struct and functions to manage the internal state of Yex.DocServer.

This module allows tracking the state of Yex.DocServer through a structured State record. It includes functions for assigning and updating state attributes with custom key-value pairs.

Summary

Functions

Assigns multiple key-value pairs to the assigns map in the state.

Assigns a single key-value pair to the assigns map in the state.

Types

t()

@type t() :: %Yex.DocServer.State{
  assigns: map(),
  awareness: Yex.Awareness.t() | nil,
  doc: Yex.Doc.t(),
  module: module()
}

Functions

assign(state, attrs)

@spec assign(t(), [{term(), term()}] | map()) :: t()

Assigns multiple key-value pairs to the assigns map in the state.

This function accepts a list or map of attributes to update the state in bulk, allowing for more comprehensive state updates at once.

assign(state, key, value)

@spec assign(t(), term(), term()) :: t()

Assigns a single key-value pair to the assigns map in the state.

This function allows for adding or updating a specific attribute in the state, useful for tracking individual properties in Yex.DocServer.