Trait TripcodeGenerator

Source
pub trait TripcodeGenerator {
    type Hash: TripcodeHash;

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

    // Provided methods
    fn generate<P: AsRef<[u8]>>(password: P) -> String { ... }
    fn append<P: AsRef<[u8]>>(password: P, dst: &mut String) { ... }
    fn write<P, W>(password: P, dst: &mut W) -> Result<()>
       where P: AsRef<[u8]>,
             W: Write { ... }
    fn generate_sjis<P: AsRef<[u8]>>(password: P) -> Vec<u8>  { ... }
    fn append_sjis<P: AsRef<[u8]>>(password: P, dst: &mut Vec<u8>) { ... }
    fn write_sjis<P, W>(password: P, dst: &mut W) -> Result<()>
       where P: AsRef<[u8]>,
             W: Write { ... }
}
Expand description

Trait for generators of tripcodes.

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 hash<P: AsRef<[u8]>>(password: P) -> Self::Hash

Generates a hash value that represents the tripcode for password.

Provided Methods§

Source

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

Generates a tripcode from password.

Source

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

Generates a tripcode from password and appends it to a String.

Source

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

Generates a tripcode into a Write.

Source

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

Generates a tripcode in Shift-JIS encoding.

Source

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

Generates a Shift-JIS-encoded tripcode and appends it to a Vec<u8>.

Source

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

Generates a Shift-JIS-encoded tripcode into a Write.

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§