Expand description
Types and functions for working with encodings.
This module defines 3 types for working with encodings, these types can
be converted back and forth with From
/Into
like so:
Encoding <-> RbEncoding <-> Index
|______________________^
Many functions that require an encoding take thier arguments as
Into<RbEncoding>
or Into<Index>
to ease working with the different
types. The type specified for the Into
conversion hints at the type the
function nativly works with, and thus will avoid any conversion cost.
Encoding
and RbEncoding
both implement TryConvert
and
IntoValue
so can be used as parameters and return values in functions
bound to Ruby. Both convert from either an instance of Encoding
or a
string of an encoding name, and convert to an instance of Encoding
.
Structs§
- Wrapper type for a Value known to be an instance of Ruby’s Encoding class.
- The index of an encoding in Ruby’s internal encodings table.
- Ruby’s internal encoding type.
Enums§
- A character type.
- Possible states of how a string matches its encoding.
- Return value for
RbEncoding::precise_mbclen
.
Traits§
- Trait that marks Ruby types cable of having an encoding.
Functions§
- Returns the common encoding between
v1
andv2
, orErr
. - Returns the common encoding between
v1
andv2
, orNone
. - Compies the encoding from
src
todst
.