Skip to content

Add Fiddle::MemoryView.available?#208

Open
himura467 wants to merge 1 commit into
ruby:masterfrom
himura467:memory-view-available-p
Open

Add Fiddle::MemoryView.available?#208
himura467 wants to merge 1 commit into
ruby:masterfrom
himura467:memory-view-available-p

Conversation

@himura467

@himura467 himura467 commented Jul 23, 2026

Copy link
Copy Markdown

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 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 thread test/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)}

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
himura467 force-pushed the memory-view-available-p branch from a166934 to cff7d57 Compare July 24, 2026 04:01
Sign up for free to 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