[][src]Struct tox_packet::toxid::NoSpam

pub struct NoSpam(pub [u8; 4]);

NoSpam used in ToxId.

Number is used to make sure that there is no friend requests from peers that know out long term PK, but don't actually know Tox ID.

The preferred way of creating NoSpam is to generate a random one.

Additionally, it should be possible to set a custom NoSpam.

https://zetok.github.io/tox-spec/#tox-id

Implementations

impl NoSpam[src]

pub fn random() -> Self[src]

Create new NoSpam with random bytes.

Two random() NoSpams will always be different:

use tox_packet::toxid::NoSpam;

assert_ne!(NoSpam::random(), NoSpam::random());

Trait Implementations

impl Clone for NoSpam[src]

impl Copy for NoSpam[src]

impl Debug for NoSpam[src]

impl Display for NoSpam[src]

Display should always be the same as UpperHex.

use tox_packet::toxid::NoSpam;

let nospam = NoSpam::random();
assert_eq!(format!("{}", nospam), format!("{:X}", nospam));

impl Eq for NoSpam[src]

impl FromBytes for NoSpam[src]

impl PartialEq<NoSpam> for NoSpam[src]

impl StructuralEq for NoSpam[src]

impl StructuralPartialEq for NoSpam[src]

impl ToBytes for NoSpam[src]

impl UpperHex for NoSpam[src]

The default formatting of NoSpam.

E.g.:

use tox_packet::toxid::NoSpam;

assert_eq!(format!("{:X}", NoSpam([0, 0, 0, 0])), "00000000");
assert_eq!(format!("{:X}", NoSpam([255, 255, 255, 255])), "FFFFFFFF");

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.