pub trait TripcodeHash: Sized {
// Required methods
fn decode(tripcode: &str) -> Option<Self>;
fn max_len() -> usize;
fn max_len_sjis() -> usize;
fn append(self, _: &mut String);
fn write<W: Write>(self, _: &mut W) -> Result<()>;
fn decode_from_sjis(_: &[u8]) -> Option<Self>;
fn append_sjis(self, _: &mut Vec<u8>);
fn write_sjis<W: Write>(self, _: &mut W) -> Result<()>;
// Provided methods
fn encode(self) -> String { ... }
fn encode_to_sjis(self) -> Vec<u8> ⓘ { ... }
}
Expand description
Trait for hash values that represent tripcodes.
Required Methods§
Sourcefn decode(tripcode: &str) -> Option<Self>
fn decode(tripcode: &str) -> Option<Self>
Decodes a tripcode into a hash value.
Returns None
when passed a invalid tripcode.
Sourcefn max_len_sjis() -> usize
fn max_len_sjis() -> usize
Returns maximum length of resulting tripcode when encoded in Shift-JIS, in bytes.
Sourcefn write<W: Write>(self, _: &mut W) -> Result<()>
fn write<W: Write>(self, _: &mut W) -> Result<()>
Encodes self
into a tripcode and writes it to a Write
.
Sourcefn decode_from_sjis(_: &[u8]) -> Option<Self>
fn decode_from_sjis(_: &[u8]) -> Option<Self>
Decodes a Shift-JIS-encoded tripcode.
Sourcefn append_sjis(self, _: &mut Vec<u8>)
fn append_sjis(self, _: &mut Vec<u8>)
Encodes self
into a Shift-JIS-encoded tripcode and appends it on a Vec<u8>
.
Provided Methods§
Sourcefn encode_to_sjis(self) -> Vec<u8> ⓘ
fn encode_to_sjis(self) -> Vec<u8> ⓘ
Encodes self
into a Shift-JIS-encoded tripcode.
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.