Trait TripcodeGeneratorFailable

Source
pub trait TripcodeGeneratorFailable {
    type Hash: TripcodeHash;

    // Required method
    fn try_hash<P: AsRef<[u8]>>(password: P) -> Option<Self::Hash>;

    // Provided methods
    fn try_generate<P: AsRef<[u8]>>(password: P) -> Option<String> { ... }
    fn try_append<P: AsRef<[u8]>>(password: P, dst: &mut String) -> Option<()> { ... }
    fn try_write<P, W>(password: P, dst: &mut W) -> Option<Result<()>>
       where P: AsRef<[u8]>,
             W: Write { ... }
    fn try_generate_sjis<P: AsRef<[u8]>>(password: P) -> Option<Vec<u8>> { ... }
    fn try_append_sjis<P: AsRef<[u8]>>(
        password: P,
        dst: &mut Vec<u8>,
    ) -> Option<()> { ... }
    fn try_write_sjis<P, W>(password: P, dst: &mut W) -> Option<Result<()>>
       where P: AsRef<[u8]>,
             W: Write { ... }
}
Expand description

Trait for tripcode generators which may fail in generation.

Required Associated Types§

Source

type Hash: TripcodeHash

The type of hash value that represents resulting tripcodes.

See the documentation for tripcode::hash module for the information of the hash value.

Required Methods§

Source

fn try_hash<P: AsRef<[u8]>>(password: P) -> Option<Self::Hash>

Attempts to generate a hash value from password.

Returns None when passed an invalid password.

Provided Methods§

Source

fn try_generate<P: AsRef<[u8]>>(password: P) -> Option<String>

Attempts to generate a tripcode from password.

Returns None when passed an invalid password.

Source

fn try_append<P: AsRef<[u8]>>(password: P, dst: &mut String) -> Option<()>

Attempts to generate a tripcode and append it to a String.

Returns None when passed an invalid password.

Source

fn try_write<P, W>(password: P, dst: &mut W) -> Option<Result<()>>
where P: AsRef<[u8]>, W: Write,

Attempts to generate a tripcode into a Write.

Returns None when passed an invalid password.

Source

fn try_generate_sjis<P: AsRef<[u8]>>(password: P) -> Option<Vec<u8>>

Attempts to generate a tripcode in Shift-JIS encoding.

Returns None when passed an invalid password.

Source

fn try_append_sjis<P: AsRef<[u8]>>(password: P, dst: &mut Vec<u8>) -> Option<()>

Attempts to generate a Shift-JIS-encoded tripcode and append it to a Vec<u8>.

Returns None when passed an invalid password.

Source

fn try_write_sjis<P, W>(password: P, dst: &mut W) -> Option<Result<()>>
where P: AsRef<[u8]>, W: Write,

Attempts to generate a Shift-JIS-encoded tripcode into a Write.

Returns None when passed an invalid password.

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§