Ruby: include/ruby/internal/intern/set.h Source File

Ruby 4.0.5p0 (2026-05-20 revision 64336ffd0ee9e1f4c05891695a3d7b49cb709721)

set.h
Go to the documentation of this file.
1#ifndef RBIMPL_INTERN_SET_H /*-*-C++-*-vi:se ft=cpp:*/
2#define RBIMPL_INTERN_SET_H
23#include "ruby/internal/attr/nonnull.h"
24#include "ruby/internal/dllexport.h"
25#include "ruby/internal/value.h"
26
27 RBIMPL_SYMBOL_EXPORT_BEGIN()
28
29/* set.c */
30
31 RBIMPL_ATTR_NONNULL(())
41void rb_set_foreach(VALUE set, int (*func)(VALUE element, VALUE arg), VALUE arg);
42
48 VALUE rb_set_new(void);
49
59 VALUE rb_set_new_capa(size_t capa);
60
68bool rb_set_lookup(VALUE set, VALUE element);
69
79bool rb_set_add(VALUE set, VALUE element);
80
89 VALUE rb_set_clear(VALUE set);
90
99bool rb_set_delete(VALUE set, VALUE element);
100
107size_t rb_set_size(VALUE set);
108
109 RBIMPL_SYMBOL_EXPORT_END()
110
111#endif /* RBIMPL_INTERN_SET_H */
dllexport.h
Tweaking visibility of C variables/functions.
RBIMPL_SYMBOL_EXPORT_END
#define RBIMPL_SYMBOL_EXPORT_END()
Counterpart of RBIMPL_SYMBOL_EXPORT_BEGIN.
Definition dllexport.h:74
RBIMPL_SYMBOL_EXPORT_BEGIN
#define RBIMPL_SYMBOL_EXPORT_BEGIN()
Shortcut macro equivalent to RUBY_SYMBOL_EXPORT_BEGIN extern "C" {.
Definition dllexport.h:65
capa
int capa
Designed capacity of the buffer.
Definition io.h:11
nonnull.h
Defines RBIMPL_ATTR_NONNULL.
RBIMPL_ATTR_NONNULL
#define RBIMPL_ATTR_NONNULL(list)
Wraps (or simulates) __attribute__((nonnull)).
Definition nonnull.h:30
rb_set_size
size_t rb_set_size(VALUE set)
Returns the number of elements in the set.
Definition set.c:1983
rb_set_clear
VALUE rb_set_clear(VALUE set)
Removes all entries from set.
Definition set.c:1971
rb_set_delete
bool rb_set_delete(VALUE set, VALUE element)
Removes the element from from set.
Definition set.c:1977
rb_set_add
bool rb_set_add(VALUE set, VALUE element)
Adds element to set.
Definition set.c:1965
rb_set_foreach
void rb_set_foreach(VALUE set, int(*func)(VALUE element, VALUE arg), VALUE arg)
Iterates over a set.
Definition set.c:1941
rb_set_lookup
bool rb_set_lookup(VALUE set, VALUE element)
Whether the set contains the given element.
Definition set.c:1959
rb_set_new
VALUE rb_set_new(void)
Creates a new, empty set object.
Definition set.c:1947
rb_set_new_capa
VALUE rb_set_new_capa(size_t capa)
Identical to rb_set_new(), except it additionally specifies how many elements it is expected to conta...
Definition set.c:1953
value.h
Defines VALUE and ID.
VALUE
uintptr_t VALUE
Type that represents a Ruby object.
Definition value.h:40