Skip to content

Add Fiddle::MemoryView.available? - #208

Merged
kou merged 1 commit into
ruby:masterfrom
himura467:memory-view-available-p
Jul 24, 2026
Merged

Add Fiddle::MemoryView.available?#208
kou merged 1 commit into
ruby:masterfrom
himura467:memory-view-available-p

Conversation

@himura467

@himura467himura467 commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Fiddle had no binding for rb_memory_view_available_p(), which callers can use to check whether an object supports the memory view protocol.

  • rake test

kou
kou approved these changes Jul 24, 2026

@koukou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Comment threadtest/fiddle/test_memory_view.rb Outdated
Comment on lines +34 to +36
assert_equal(true, MemoryView.available?(Pointer["hello world"]))
assert_equal(false, MemoryView.available?(Fiddle::NULL))
assert_equal(false, MemoryView.available?(Object.new))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you use power assert style for better message on failure?

Suggested change
assert_equal(true,MemoryView.available?(Pointer["hello world"]))
assert_equal(false,MemoryView.available?(Fiddle::NULL))
assert_equal(false,MemoryView.available?(Object.new))
assert{MemoryView.available?(Pointer["hello world"])}
assert{!MemoryView.available?(Fiddle::NULL)}
assert{!MemoryView.available?(Object.new)}

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

Fiddle had no binding for `rb_memory_view_available_p()`, which callers can use to check whether an object supports the memory view protocol.
@himura467
himura467force-pushed the memory-view-available-p branch from a166934 to cff7d57CompareJuly 24, 2026 04:01
@kou
kou merged commit 1c54c9b into ruby:masterJul 24, 2026
67 checks passed
@kou

kou commented Jul 24, 2026

Copy link
Copy Markdown
Member

Thanks.

@himura467
himura467 deleted the memory-view-available-p branch July 24, 2026 05:54
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@himura467@kou