caffeine_lang/types/common/generic_dictionary
Types
A dictionary that stores typed values
pub type GenericDictionary {
GenericDictionary(entries: dict.Dict(String, TypedValue))
}
Constructors
-
GenericDictionary(entries: dict.Dict(String, TypedValue))
A value with its type information
pub type TypedValue {
TypedValue(
value: String,
type_def: accepted_types.AcceptedTypes,
)
}
Constructors
-
TypedValue(value: String, type_def: accepted_types.AcceptedTypes)
Values
pub fn from_string_dict(
values: dict.Dict(String, String),
type_defs: dict.Dict(String, accepted_types.AcceptedTypes),
) -> Result(GenericDictionary, String)
Creates a new GenericDictionary from string values and their type definitions
pub fn get(
dict: GenericDictionary,
key: String,
) -> Result(TypedValue, String)
Gets a typed value from the dictionary
pub fn get_string_value(typed_value: TypedValue) -> String
Gets the string value from a TypedValue
pub fn get_type_definition(
typed_value: TypedValue,
) -> accepted_types.AcceptedTypes
Gets the type definition from a TypedValue
pub fn new_typed_value(
value: String,
type_def: accepted_types.AcceptedTypes,
) -> TypedValue
Creates a new typed value
pub fn to_string_dict(
dict: GenericDictionary,
) -> dict.Dict(String, String)
Converts a GenericDictionary to a regular dict of strings