`data_size` not rendered through YARD
Hey,
I have a feature request. In my work, I'm interested in knowing the memory usage of a WASM module. In particular, I want to expose https://docs.rs/wasmtime/latest/wasmtime/struct.Memory.html#method.data_size
I would simply have the same API in Ruby. Happy to contribute a PR.
Hi @erickguan, having that API surfaced in Ruby makes sense to me. Feel free to send a PR, I'll be happy to review it.
Sorry, I missed data_size function in the code. Memory has data_size. But YARD documentation doesn't have it.
I debugged a little. bundle exec rake doc generates JSON describing the methods but classes are not in doc. Doc generation from my machine:
That makes sense, thanks for debugging this. The doc rake task generates a json file with the documentation metadata. As far as I can tell, data_size is in there. I still need to figure out why it's not rendered though.
Does rust change this JSON format between last doc release? I poked my "fresh" environment:
require 'yard'
require 'yard-rustdoc'
json_data = File.read('tmp/doc/wasmtime_rb.json')
puts "Loaded JSON data: #{json_data[0..500]}" # print the first 500 characters to verify
YARD::Registry.load(['tmp/doc/wasmtime_rb.json'])
YARD::Registry.all.each do |obj|
puts obj.inspect
end
Loaded JSON data: {"root":"0:0:1857","crate_version":"9.0.4","includes_private":true,"index":{"0:187:1036":{"id":"0:187:1036","crate_id":0,"name":"new","span":{"filename":"ext/src/ruby_api/config/tracked_memory_creator.rs","begin":[11,4],"end":[17,5]},"visibility":"crate","docs":null,"links":{},"attrs":[],"deprecation":null,"inner":{"function":{"decl":{"inputs":[["inner",{"resolved_path":{"name":"Box","id":"5:281:2329","args":{"angle_bracketed":{"args":[{"type":{"dyn_trait":{"traits":[{"trait":{"name":"RuntimeLine
#<yardoc module Wasmtime>
#<yardoc class Wasmtime::Error>
#<yardoc class Wasmtime::ResultError>
#<yardoc class Wasmtime::ConversionError>
#<yardoc class Wasmtime::Trap>
#<yardoc constant Wasmtime::Trap::STACK_OVERFLOW>
#<yardoc constant Wasmtime::Trap::MEMORY_OUT_OF_BOUNDS>
#<yardoc constant Wasmtime::Trap::HEAP_MISALIGNED>
#<yardoc constant Wasmtime::Trap::TABLE_OUT_OF_BOUNDS>
#<yardoc constant Wasmtime::Trap::INDIRECT_CALL_TO_NULL>
#<yardoc constant Wasmtime::Trap::BAD_SIGNATURE>
#<yardoc constant Wasmtime::Trap::INTEGER_OVERFLOW>
#<yardoc constant Wasmtime::Trap::INTEGER_DIVISION_BY_ZERO>
#<yardoc constant Wasmtime::Trap::BAD_CONVERSION_TO_INTEGER>
#<yardoc constant Wasmtime::Trap::UNREACHABLE_CODE_REACHED>
#<yardoc constant Wasmtime::Trap::INTERRUPT>
#<yardoc constant Wasmtime::Trap::ALWAYS_TRAP_ADAPTER>
#<yardoc constant Wasmtime::Trap::OUT_OF_FUEL>
#<yardoc constant Wasmtime::Trap::UNKNOWN>
#<yardoc class Wasmtime::WasiExit>
#<yardoc method Wasmtime::WasiExit#code>
#<yardoc method Wasmtime::WasiExit#initialize>
#<yardoc method Wasmtime::WasiExit#message>
#<yardoc constant Wasmtime::VERSION>
I would suspect yard-rustdoc might trailing behind. Maybe validate firstly if rust doc had an update. And perhaps write an issue if rust json doc update cause the problem.