Skip to content

Commit

Permalink
chore(README): add callback example
Browse files Browse the repository at this point in the history
  • Loading branch information
stakach committed Jul 19, 2024
1 parent 3a4d03c commit 64e3539
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,23 @@ Failed to verify reading basic at VerifyData.checksum

Inheritance is also supported

## Callbacks

Callbacks can helpful for providing accessors for simplified representations of the data.

```crystal
class CallbackTest < BinData
endian little
field integer : UInt8
property external_representation : UInt16 = 0
before_serialize { self.integer = (external_representation // 2).to_u8 }
after_deserialize { self.external_representation = integer.to_u16 * 2_u16 }
end
```

## ASN.1 Helpers

Included in this library are helpers for decoding and writing ASN.1 data, such as those used in SNMP and LDAP
Expand Down

0 comments on commit 64e3539

Please sign in to comment.