Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fields offset in serialized bytes array #599

@Handy-caT

Description

@Handy-caT

Is there any methods that will help to find offset for a field in serialized struct in a byte array?

Sometimes I need to access data parts, that was written on disk and I don't want to load full object to access it's using rkyv API. So I tried to find a way to calculate offset for some field, but it's very unstable and this logic differs from structure to structure. So I wonder if there is any method that can return field offset from byte array start (for existing structure)?

For example I have struct

struct Test {
  first: u32,
  second: u64,
  third: String,
}

Is it possible to find second's offset in byte array after rkyv::to_bytes?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions