falco_event::fields

Trait ToBytes

source
pub trait ToBytes {
    // Required methods
    fn binary_size(&self) -> usize;
    fn write<W: Write>(&self, writer: W) -> Result<()>;
    fn default_repr() -> impl ToBytes;
}
Expand description

Convert a field to binary representation

Required Methods§

source

fn binary_size(&self) -> usize

Return the number of bytes needed to store the field

source

fn write<W: Write>(&self, writer: W) -> Result<()>

Write the binary representation to writer

source

fn default_repr() -> impl ToBytes

Return the default representation for the field type

Note: this does not need to be the same type as the implementing type. For example, an empty C-style string can be represented e.g. by returning 0u8.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl ToBytes for &CStr

source§

fn binary_size(&self) -> usize

source§

fn write<W: Write>(&self, writer: W) -> Result<()>

source§

fn default_repr() -> impl ToBytes

source§

impl ToBytes for &[u8]

source§

fn binary_size(&self) -> usize

source§

fn write<W: Write>(&self, writer: W) -> Result<()>

source§

fn default_repr() -> impl ToBytes

source§

impl ToBytes for (Ipv4Addr, Port)

source§

fn binary_size(&self) -> usize

source§

fn write<W: Write>(&self, writer: W) -> Result<()>

source§

fn default_repr() -> impl ToBytes

source§

impl ToBytes for (Ipv6Addr, Port)

source§

fn binary_size(&self) -> usize

source§

fn write<W: Write>(&self, writer: W) -> Result<()>

source§

fn default_repr() -> impl ToBytes

source§

impl ToBytes for bool

source§

fn binary_size(&self) -> usize

source§

fn write<W: Write>(&self, writer: W) -> Result<()>

source§

fn default_repr() -> impl ToBytes

source§

impl ToBytes for i8

source§

fn binary_size(&self) -> usize

source§

fn write<W: Write>(&self, writer: W) -> Result<()>

source§

fn default_repr() -> impl ToBytes

source§

impl ToBytes for i16

source§

fn binary_size(&self) -> usize

source§

fn write<W: Write>(&self, writer: W) -> Result<()>

source§

fn default_repr() -> impl ToBytes

source§

impl ToBytes for i32

source§

fn binary_size(&self) -> usize

source§

fn write<W: Write>(&self, writer: W) -> Result<()>

source§

fn default_repr() -> impl ToBytes

source§

impl ToBytes for i64

source§

fn binary_size(&self) -> usize

source§

fn write<W: Write>(&self, writer: W) -> Result<()>

source§

fn default_repr() -> impl ToBytes

source§

impl ToBytes for u8

source§

fn binary_size(&self) -> usize

source§

fn write<W: Write>(&self, writer: W) -> Result<()>

source§

fn default_repr() -> impl ToBytes

source§

impl ToBytes for u16

source§

fn binary_size(&self) -> usize

source§

fn write<W: Write>(&self, writer: W) -> Result<()>

source§

fn default_repr() -> impl ToBytes

source§

impl ToBytes for u32

source§

fn binary_size(&self) -> usize

source§

fn write<W: Write>(&self, writer: W) -> Result<()>

source§

fn default_repr() -> impl ToBytes

source§

impl ToBytes for u64

source§

fn binary_size(&self) -> usize

source§

fn write<W: Write>(&self, writer: W) -> Result<()>

source§

fn default_repr() -> impl ToBytes

source§

impl<'a> ToBytes for Vec<&'a CStr>

source§

fn binary_size(&self) -> usize

source§

fn write<W: Write>(&self, writer: W) -> Result<()>

source§

fn default_repr() -> impl ToBytes

source§

impl<'a> ToBytes for Vec<(&'a CStr, &'a CStr)>

source§

fn binary_size(&self) -> usize

source§

fn write<W: Write>(&self, writer: W) -> Result<()>

source§

fn default_repr() -> impl ToBytes

source§

impl<T: ToBytes> ToBytes for Option<T>

source§

fn binary_size(&self) -> usize

source§

fn write<W: Write>(&self, writer: W) -> Result<()>

source§

fn default_repr() -> impl ToBytes

Implementors§

source§

impl ToBytes for &Path

source§

impl ToBytes for PT_DYN_bpf_dynamic_param

source§

impl ToBytes for PT_DYN_ptrace_dynamic_param

source§

impl ToBytes for PT_ENUMFLAGS8_fcntl_commands

source§

impl ToBytes for PT_ENUMFLAGS8_lseek_whence

source§

impl ToBytes for PT_ENUMFLAGS8_rlimit_resources

source§

impl ToBytes for PT_ENUMFLAGS8_shutdown_how

source§

impl ToBytes for PT_ENUMFLAGS8_sockopt_levels

source§

impl ToBytes for PT_ENUMFLAGS8_sockopt_options

source§

impl ToBytes for PT_ENUMFLAGS16_io_uring_register_opcodes

source§

impl ToBytes for PT_ENUMFLAGS16_ptrace_requests

source§

impl ToBytes for PT_ENUMFLAGS32_bpf_commands

source§

impl ToBytes for PT_ENUMFLAGS32_fsconfig_cmds

source§

impl ToBytes for PT_ENUMFLAGS32_prctl_options

source§

impl ToBytes for PT_ENUMFLAGS32_socket_families

source§

impl ToBytes for IpAddr

source§

impl ToBytes for SockAddr<'_>

source§

impl ToBytes for SockTuple<'_>

source§

impl ToBytes for PT_FLAGS8_quotactl_dqi_flags

source§

impl ToBytes for PT_FLAGS8_quotactl_quota_fmts

source§

impl ToBytes for PT_FLAGS8_quotactl_types

source§

impl ToBytes for PT_FLAGS16_creat_flags

source§

impl ToBytes for PT_FLAGS16_file_flags

source§

impl ToBytes for PT_FLAGS16_futex_operations

source§

impl ToBytes for PT_FLAGS16_quotactl_cmds

source§

impl ToBytes for PT_FLAGS16_semctl_commands

source§

impl ToBytes for PT_FLAGS16_semop_flags

source§

impl ToBytes for PT_FLAGS32_access_flags

source§

impl ToBytes for PT_FLAGS32_clone_flags

source§

impl ToBytes for PT_FLAGS32_delete_module_flags

source§

impl ToBytes for PT_FLAGS32_epoll_create1_flags

source§

impl ToBytes for PT_FLAGS32_execve_flags

source§

impl ToBytes for PT_FLAGS32_execveat_flags

source§

impl ToBytes for PT_FLAGS32_fchownat_flags

source§

impl ToBytes for PT_FLAGS32_file_flags

source§

impl ToBytes for PT_FLAGS32_finit_module_flags

source§

impl ToBytes for PT_FLAGS32_flock_flags

source§

impl ToBytes for PT_FLAGS32_io_uring_enter_flags

source§

impl ToBytes for PT_FLAGS32_io_uring_setup_feats

source§

impl ToBytes for PT_FLAGS32_io_uring_setup_flags

source§

impl ToBytes for PT_FLAGS32_linkat_flags

source§

impl ToBytes for PT_FLAGS32_memfd_create_flags

source§

impl ToBytes for PT_FLAGS32_mlock2_flags

source§

impl ToBytes for PT_FLAGS32_mlockall_flags

source§

impl ToBytes for PT_FLAGS32_mmap_flags

source§

impl ToBytes for PT_FLAGS32_mount_flags

source§

impl ToBytes for PT_FLAGS32_newfstatat_flags

source§

impl ToBytes for PT_FLAGS32_openat2_flags

source§

impl ToBytes for PT_FLAGS32_pf_flags

source§

impl ToBytes for PT_FLAGS32_pidfd_open_flags

source§

impl ToBytes for PT_FLAGS32_prot_flags

source§

impl ToBytes for PT_FLAGS32_renameat2_flags

source§

impl ToBytes for PT_FLAGS32_semget_flags

source§

impl ToBytes for PT_FLAGS32_splice_flags

source§

impl ToBytes for PT_FLAGS32_umount_flags

source§

impl ToBytes for PT_FLAGS32_unlinkat_flags

source§

impl ToBytes for PT_MODE_chmod_mode

source§

impl ToBytes for PT_MODE_mknod_mode

source§

impl ToBytes for NoDefault

source§

impl ToBytes for SystemTime

source§

impl ToBytes for Bool

source§

impl ToBytes for SyscallResult

source§

impl ToBytes for Fd

source§

impl ToBytes for FdList

source§

impl ToBytes for Gid

source§

impl ToBytes for IpNet

source§

impl ToBytes for Ipv4Addr

source§

impl ToBytes for Ipv4Net

source§

impl ToBytes for Ipv6Addr

source§

impl ToBytes for Ipv6Net

source§

impl ToBytes for Pid

source§

impl ToBytes for Port

source§

impl ToBytes for Duration

source§

impl ToBytes for SigSet

source§

impl ToBytes for SigType

source§

impl ToBytes for SockFamily

source§

impl ToBytes for SyscallId

source§

impl ToBytes for Uid

source§

impl<'a> ToBytes for PT_DYN_sockopt_dynamic_param<'a>

source§

impl<'a> ToBytes for RelativePath<'a>

source§

impl<T> ToBytes for T
where T: Borrow + 'static, for<'a> <T as Borrow>::Borrowed<'a>: ToBytes,