Crate rusticata_macros [] [src]

Rusticata-macros

Helper macros for the rusticata project.

Reexports

pub use macros::*;
pub use gen::*;

Modules

gen

Generator combinator, based on nom's syntax.

macros

Helper macros

Macros

do_gen

Applies sub-generators in a sequence.

error_if

Helper macro for nom parsers: raise error if the condition is false

gen_adjust_length_u16

Write the length taken from (start) to (current position) at (offset) Then, returns to current offset

gen_align

gen_align!(I, u8) => I -> Result<I,E> Align the output buffer to the next multiple of specified value.

gen_at_offset

gen_at_offset!(usize, I -> Result<I,E>) => I -> Result<I,E> Combinator to call generator at an absolute offset.

gen_at_rel_offset

gen_at_offset!(usize, I -> Result<I,E>) => I -> Result<I,E> Combinator to call generator at a relative offset.

gen_be_u16

gen_be_u16!(I, u8) => I -> Result<I,E> Write an unsigned 2 bytes integer (using big-endian order).

gen_be_u24

gen_be_u24!(I, u8) => I -> Result<I,E> Write an unsigned 3 bytes integer (using big-endian order).

gen_be_u32

gen_be_u32!(I, u8) => I -> Result<I,E> Write an unsigned 4 bytes integer (using big-endian order).

gen_be_u8

gen_be_u8!(I, u8) => I -> Result<I,E> Write an unsigned 1 byte integer.

gen_call

Used to wrap common expressions and function as macros

gen_cond

gen_cond!(bool, I -> Result<I,E>) => I -> Result<I,E> Conditional combinator

gen_copy

gen_copy!(I, &[u8], u8) => I -> Result<I,E> Writes a slice, copying only the specified number of bytes to the output buffer.

gen_if_else

gen_if_else!(bool, I -> Result<I,E>, I -> Result<I,E>) => I -> Result<I,E> Conditional combinator, with alternate generator.

gen_length_slice
gen_many

gen_many!(I, Iterable<V>, Fn(I,V)) => I -> Result<I,E> Applies the generator $f to every element of $l, passing arguments by value.

gen_many_ref

gen_many_ref!(I, Iterable<V>, Fn(I,V)) => I -> Result<I,E> Applies the generator $f to every element of $l, passing arguments by reference.

gen_skip

gen_skip!(I, u8) => I -> Result<I,E> Skip the specified number of bytes.

gen_slice

gen_slice!(I, &[u8]) => I -> Result<I,E> Writes a slice, copying it entirely to the output buffer.

parse_hex_to_u64

Read a slice as a big-endian value.