Trait AddToTuple

Source
pub trait AddToTuple<T>
where Self: Sized,
{ // Required method fn add(&mut self, input: T); // Provided method fn with(self, input: T) -> Self { ... } }
Expand description

An extension trait to simplify working with segments

Required Methods§

Source

fn add(&mut self, input: T)

Add a new segment to a tuple

Provided Methods§

Source

fn with(self, input: T) -> Self

A fluent interface for adding a new segment to a tuple

Examples

use binary_tuples::*;

let user_1 = 1;

let tuple = Tuple::new()
    .with("users")
    .with(user_1)
    .into_bytes();

assert_eq!(tuple, vec![2, 117, 115, 101, 114, 115, 0, 21, 1]);

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§