Help language development. Donate to The Perl Foundation

LibGit2 cpan:CTILMES last updated on 2020-08-18

lib/Git/Buffer.rakumod
use NativeCall;

class Git::Buffer is repr('CStruct')
{
    has CArray[uint8] $.ptr;
    has size_t $.asize;
    has size_t $.size;

    method buf
    {
        buf8.new($!ptr[^$!size])
    }

    method str
    {
        self.buf.decode
    }

    sub git_buf_free(Git::Buffer)
        is native('git2') {}

    submethod DESTROY { git_buf_free(self) }
}