Go to the source code of this file.
◆ srn_map_assoc()
Definition at line 66 of file maps.c.
67 {
72
74 return srn_errors_make_error(ctx, metadata,
ABSURD,
"expected a map");
75 }
76
78
81
84}
srn_value_t * srn_value_make(srn_context_t *ctx, srn_value_tag_t tag, srn_metadata_t *metadata, void *payload)
Creates a new serene value.
#define AS_MAP(value_ref)
#define IS_A(value_ref, field)
hmap_key_t * hmap_make_key(srn_context_t *ctx, void *data, size_t len)
Create a new key out of the given data, with the given len.
static const hmap_control_t value_map
Note: For key equality we use the memcpy function.
A persistent, immutable map.
#define PANIC_IF_NULL(ptr)
◆ srn_map_empty()
Definition at line 59 of file maps.c.
59 {
64}
hmap_t hmap_empty(srn_context_t *ctx)
Create, initialize and return a new hashmap.
◆ srn_vmap_cmp()
Definition at line 28 of file maps.c.
28 {
34 return false;
36 return true;
37 default:
38 PANIC(
"Should never happen");
39 }
40}
srn_value_t * srn_value_eq(srn_context_t *ctx, const srn_value_t *a, const srn_value_t *b)
Check to values for equality. Return a boolean.
void * data
len 0 -> data == nullptr
◆ srn_vmap_hash()
Definition at line 43 of file maps.c.
43 {
47
50}
srn_hash_t srn_value_hash(srn_context_t *ctx, const srn_value_t *v)
Compute the xxHash32 of a value using the engine seed.
◆ value_map
Initial value:= {
}
void * hmap_lookup_ctl(const hmap_control_t *ctl, srn_context_t *ctx, const hmap_t *hmap, const hmap_key_t *k, void *default_value)
Just like the hmap_lookup function but, it receives a hmap_control_t to customize the comparison and ...
hmap_t hmap_insert_ctl(const hmap_control_t *ctl, srn_context_t *ctx, const hmap_t *hmap, hmap_key_t *k, void *v)
Just like the hmap_insert function but, it receives a hmap_control_t to customize the comparison and ...
static hmap_hash_t srn_vmap_hash(srn_context_t *ctx, const hmap_key_t *k)
static bool srn_vmap_cmp(srn_context_t *ctx, const hmap_key_t *a, const hmap_key_t *b)
Definition at line 52 of file maps.c.