Function encoding_c::encoding_for_name
[−]
[src]
#[no_mangle]pub unsafe extern fn encoding_for_name(name: *const u8,
name_len: usize)
-> *const Encoding
If the argument matches exactly (case-sensitively; no whitespace
removal performed) the name of an encoding, returns
const Encoding*
representing that encoding. Otherwise panics.
The motivating use case for this function is interoperability with
legacy Gecko code that represents encodings as name string instead of
type-safe Encoding
objects. Using this function for other purposes is
most likely the wrong thing to do.
Panics
Panics if the argument is not the name of an encoding.
Undefined behavior
UB ensues if name
and name_len
don't designate a valid memory block.