Sha256: ea8898e5e4543604efe20e5717e9f20813d8ab472f8f31826bbf50441b26c680

Contents?: true

Size: 677 Bytes

Versions: 7

Compression:

Stored size: 677 Bytes

Contents

require 'ffi/msgpack/types'

module FFI
  module MsgPack
    class MsgRaw < FFI::Struct

      layout :size, :uint32,
             :ptr, :pointer

      #
      # The length of the raw data.
      #
      # @return [Integer]
      #   The length of the raw data.
      #
      def length
        self[:size]
      end

      #
      # The pointer to the raw data.
      #
      # @return [FFI::Pointer]
      #   The pointer to the raw data.
      #
      def raw
        self[:ptr]
      end

      #
      # The raw data.
      #
      # @return [String]
      #   The raw data.
      #
      def to_s
        self[:ptr].get_bytes(0,self[:size])
      end

    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ffi-msgpack-0.2.1 lib/ffi/msgpack/msg_raw.rb
ffi-msgpack-0.2.0 lib/ffi/msgpack/msg_raw.rb
ffi-msgpack-0.1.4 lib/ffi/msgpack/msg_raw.rb
ffi-msgpack-0.1.3 lib/ffi/msgpack/msg_raw.rb
ffi-msgpack-0.1.2 lib/ffi/msgpack/msg_raw.rb
ffi-msgpack-0.1.1 lib/ffi/msgpack/msg_raw.rb
ffi-msgpack-0.1.0 lib/ffi/msgpack/msg_raw.rb