Project

General

Profile

Actions

Feature #21459

open

Add Set C-API

Added by jeremyevans0 (Jeremy Evans) 1 day ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:122618]

Description

I would like to add a minimal C-API for Set:

void rb_set_foreach(VALUE set, int (*func)(VALUE element, VALUE arg), VALUE arg);
VALUE rb_set_new(void);
VALUE rb_set_new_capa(unsigned long capa);
bool rb_set_lookup(VALUE set, VALUE element);
bool rb_set_add(VALUE set, VALUE element);
VALUE rb_set_clear(VALUE set);
bool rb_set_delete(VALUE set, VALUE element);
size_t rb_set_size(VALUE set);

I think this should allow extension libraries to start benefiting from core Set without having to resort to method calls (dangerous in an C extension as they could be redefined to return objects of an unexpected type).

I've submitted a pull request for this: https://github.com/ruby/ruby/pull/13735

No data to display

Actions

Also available in: Atom PDF

Like0