Skip to content

Commit f728a43

Browse files
committed
doc: Add doc
1 parent 7775e9d commit f728a43

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/binary_parser/byte_size.cr

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,19 @@
11
class BinaryParser
2+
3+
# Calculate bytesize support
4+
#
5+
# ```crystal
6+
# class Parser < BinaryParser
7+
# uint8 :value1
8+
# uint8 :value2
9+
# include BinaryParser::ByteSize
10+
# end
11+
#
12+
# parser = Parser.new
13+
# parser.bytesize # sizeof(UInt8) * 2
14+
#
15+
# ```
16+
#
217
module ByteSize
318
macro included
419
@static_size : Int32?

0 commit comments

Comments
 (0)