Skip to content

Commit 2b31142

Browse files
committed
Add documentation for Faidx class to clarify its structure and lifetime management
1 parent 0ee0306 commit 2b31142

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

lib/hts/libhts/constants.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,13 @@ def self.release(ptr)
439439

440440
FaiFormatOptions = enum(:FAI_NONE, :FAI_FASTA, :FAI_FASTQ)
441441

442-
class Faidx < FFI::Struct # FIXME: ManagedStruct
442+
# Faidx represents a faidx_t handle which is treated as a
443+
# file-level RAII object in HTS::Faidx. It is intentionally
444+
# kept as a plain Struct and is destroyed explicitly via
445+
# LibHTS.fai_destroy in HTS::Faidx#close. Do not convert this
446+
# to ManagedStruct; that would interfere with the explicit
447+
# lifetime managed by the Ruby wrapper.
448+
class Faidx < FFI::Struct
443449
layout :bgzf, BGZF.ptr,
444450
:n, :int,
445451
:m, :int,

0 commit comments

Comments
 (0)