cx
Types
pub type Context {
CString(value: String)
CInt(value: Int)
CFloat(value: Float)
CDict(value: Dict(String, Context))
CList(value: List(Context))
}
Constructors
-
CString(value: String)
-
CInt(value: Int)
-
CFloat(value: Float)
-
CDict(value: Dict(String, Context))
-
CList(value: List(Context))
pub type ContextError {
KeyNotFound(key: String)
ValueNotFound(key: String)
UnexpectedContextType(key: String)
}
Constructors
-
KeyNotFound(key: String)
-
ValueNotFound(key: String)
-
UnexpectedContextType(key: String)
Functions
pub fn add(
context: Context,
key: String,
value: Context,
) -> Context
pub fn add_float(
context: Context,
key: String,
value: Float,
) -> Context
pub fn add_int(
context: Context,
key: String,
value: Int,
) -> Context
pub fn add_list(
context: Context,
key: String,
value: List(Context),
) -> Context
pub fn add_string(
context: Context,
key: String,
value: String,
) -> Context
pub fn add_strings(
context: Context,
key: String,
values: List(String),
) -> Context
pub fn dict() -> Context
pub fn get(
context: Context,
key: String,
) -> Result(Context, ContextError)
pub fn get_list(
context: Context,
key: String,
) -> Result(List(Context), ContextError)
pub fn get_string(
context: Context,
key: String,
) -> Result(String, ContextError)
pub fn get_strings(
context: Context,
key: String,
) -> Result(List(String), ContextError)
Get a list of strings stored in the context under a given key.