pub struct DynamicTnid(/* private fields */);Expand description
A TNID with runtime-determined name.
Unlike Tnid<Name>, which enforces name correctness at compile time,
DynamicTnid accepts any valid TNID name and validates it at runtime. This makes it
suitable for parsing TNIDs from external sources or working with mixed TNID types.
§Conversions
- Convert from
Tnid<Name>usingFrom - Convert to
Tnid<Name>usingTryFrom(validates name matches) - Convert from
UuidLikeusingTryFrom(validates TNID structure) - Convert to
UuidLikeusingFrom
§Examples
use tnid::{DynamicTnid, NameStr};
// Create a new TNID
let name = NameStr::new("user").unwrap();
let id = DynamicTnid::new_v0(name);
// Parse from string
let parsed = DynamicTnid::parse_tnid_string("user.Br2flcNDfF6LYICnT").unwrap();
// Get the name
println!("Name: {}", parsed.name());Implementations§
Source§impl DynamicTnid
impl DynamicTnid
Sourcepub fn new_v0(name: NameStr<'_>) -> Self
Available on crate features time and rand only.
pub fn new_v0(name: NameStr<'_>) -> Self
time and rand only.Generates a new v0 TNID with the given name.
This variant is time-ordered with millisecond precision, similar to UUIDv7. TNIDs created earlier will sort before those created later in all representations (u128, UUID hex, and TNID string). The remaining bits are filled with random data.
Use this when you need time-based sorting and want IDs to be roughly chronological, similar to choosing UUIDv7 over UUIDv4.
§Examples
use tnid::{DynamicTnid, NameStr};
let name = NameStr::new("user").unwrap();
let id = DynamicTnid::new_v0(name);Sourcepub fn new_time_ordered(name: NameStr<'_>) -> Self
Available on crate features time and rand only.
pub fn new_time_ordered(name: NameStr<'_>) -> Self
time and rand only.Generates a new time-ordered TNID (alias for Self::new_v0).
This variant is sortable by creation time, similar to UUIDv7. TNIDs created earlier will sort before those created later in all representations (u128, UUID hex, TNID string).
Use this when you need time-based sorting, similar to choosing UUIDv7 over UUIDv4.
Sourcepub fn new_v0_with_time(name: NameStr<'_>, time: OffsetDateTime) -> Self
Available on crate features time and rand only.
pub fn new_v0_with_time(name: NameStr<'_>, time: OffsetDateTime) -> Self
time and rand only.Generates a new v0 TNID with a specific timestamp.
This allows you to control the timestamp portion of the TNID, useful for testing or when you want IDs to reflect a specific point in time. The remaining bits are filled with random data.
§Timestamp Range
The timestamp field uses 43 bits to store milliseconds since the Unix epoch. Times outside the representable range (1970-01-01 to ~2248) will wrap around:
- Pre-epoch times (before 1970-01-01): Wrap to appear as far-future timestamps.
- Post-2248 times: Wrap to appear as past timestamps.
See Tnid::new_v0_with_time for more details.
§Examples
use tnid::{DynamicTnid, NameStr};
use time::{OffsetDateTime, Duration};
let name = NameStr::new("user").unwrap();
let now = OffsetDateTime::now_utc();
let id = DynamicTnid::new_v0_with_time(name, now);Sourcepub fn new_v0_with_parts(
name: NameStr<'_>,
epoch_millis: u64,
random: u64,
) -> Self
pub fn new_v0_with_parts( name: NameStr<'_>, epoch_millis: u64, random: u64, ) -> Self
Generates a new v0 TNID with explicit timestamp and random components.
This is the lowest-level constructor for v0 TNIDs, giving you full control over both the timestamp and random portions. Useful when you need reproducible IDs (e.g., for testing) or when integrating with external randomness sources.
§Examples
use tnid::{DynamicTnid, NameStr};
let name = NameStr::new("user").unwrap();
let timestamp_ms = 1750118400000;
let random_bits = 42;
let id = DynamicTnid::new_v0_with_parts(name, timestamp_ms, random_bits);Sourcepub fn new_v1(name: NameStr<'_>) -> Self
Available on crate feature rand only.
pub fn new_v1(name: NameStr<'_>) -> Self
rand only.Generates a new v1 TNID with the given name.
This variant maximizes entropy with 100 bits of random data, similar to UUIDv4. This is almost certainly sufficient for most use cases.
Use this when you don’t need time-based sorting and want maximum randomness, similar to choosing UUIDv4 over UUIDv7.
§Examples
use tnid::{DynamicTnid, NameStr};
let name = NameStr::new("user").unwrap();
let id = DynamicTnid::new_v1(name);Sourcepub fn new_high_entropy(name: NameStr<'_>) -> Self
Available on crate feature rand only.
pub fn new_high_entropy(name: NameStr<'_>) -> Self
rand only.Generates a new TNID with maximum randomness (alias for Self::new_v1).
This variant provides the highest entropy, similar to UUIDv4. Use this when you don’t need time-based sorting.
§Examples
use tnid::{DynamicTnid, NameStr};
let name = NameStr::new("user").unwrap();
let id = DynamicTnid::new_high_entropy(name);Sourcepub fn new_v1_with_random(name: NameStr<'_>, random_bits: u128) -> Self
pub fn new_v1_with_random(name: NameStr<'_>, random_bits: u128) -> Self
Generates a new v1 TNID with explicit random bits.
This allows you to provide your own source of randomness, useful for testing or when integrating with specific random number generators.
§Examples
use tnid::{DynamicTnid, NameStr};
let name = NameStr::new("user").unwrap();
let random_bits = 0x0123456789ABCDEF0123456789ABCDEF;
let id = DynamicTnid::new_v1_with_random(name, random_bits);Sourcepub fn from_u128(id: u128) -> Result<Self, ParseTnidError>
pub fn from_u128(id: u128) -> Result<Self, ParseTnidError>
Creates a TNID from a raw 128-bit value.
This is the inverse of Self::as_u128 and is useful for loading TNIDs from
databases that store UUIDs as u128/binary, interoperating with UUID-based systems,
or deserializing.
Returns Err if the value is not a valid TNID. Validation includes:
- Correct UUIDv8 version and variant bits
- Valid name encoding (1-4 characters, properly encoded)
§Endianness
When loading from bytes, you’ll almost certainly want to parse a [u8; 16] to a
u128 using big-endian byte order with u128::from_be_bytes(), as per the
UUID specification.
§Examples
use tnid::DynamicTnid;
let id = DynamicTnid::from_u128(0xCAB1952A_F09D_86D9_928E_96EA03DC6AF3).unwrap();
assert_eq!(id.name(), "test");Sourcepub fn parse_tnid_string(s: &str) -> Result<Self, ParseTnidError>
pub fn parse_tnid_string(s: &str) -> Result<Self, ParseTnidError>
Parses a TNID from its string representation.
This is the inverse of Self::to_tnid_string.
Returns Err if the string is invalid. Validation includes:
- Correct format (
<name>.<encoded-data>) - Valid name (1-4 characters, from allowed character set)
- Valid TNID Data Encoding
- Correct UUIDv8 version and variant bits
§Examples
use tnid::DynamicTnid;
// Successful parsing
let parsed = DynamicTnid::parse_tnid_string("user.Br2flcNDfF6LYICnT").unwrap();
assert_eq!(parsed.name(), "user");
// Failed parsing - invalid format
assert!(DynamicTnid::parse_tnid_string("not-a-tnid").is_err());Sourcepub fn parse_uuid_string(s: &str) -> Result<Self, ParseTnidError>
pub fn parse_uuid_string(s: &str) -> Result<Self, ParseTnidError>
Parses a TNID from UUID hex string format.
This is the inverse of Self::to_uuid_string.
The parser accepts both uppercase and lowercase hex digits (A-F or a-f).
Returns Err if:
- The string is not a valid UUID format
- The UUID is not a valid TNID (wrong version/variant bits or invalid name encoding)
§Examples
use tnid::{DynamicTnid, NameStr};
// Create a TNID and convert to UUID string
let name = NameStr::new("user").unwrap();
let original = DynamicTnid::new_v1(name);
use tnid::Case;
let uuid_string = original.to_uuid_string(Case::Lower);
// Parse it back
let parsed = DynamicTnid::parse_uuid_string(&uuid_string).unwrap();
assert_eq!(parsed.as_u128(), original.as_u128());
// Also accepts uppercase
let uuid_upper = original.to_uuid_string(Case::Upper);
let parsed_upper = DynamicTnid::parse_uuid_string(&uuid_upper).unwrap();
// Invalid: not a valid UUID format
assert!(DynamicTnid::parse_uuid_string("not-a-uuid").is_err());Sourcepub fn name(&self) -> String
pub fn name(&self) -> String
Returns the TNID’s name as a string.
§Examples
use tnid::{DynamicTnid, NameStr};
let name = NameStr::new("user").unwrap();
let id = DynamicTnid::new_v0(name);
assert_eq!(id.name(), "user");Sourcepub fn name_hex(&self) -> String
pub fn name_hex(&self) -> String
Returns the name encoded as a 5-character hex string.
This is useful for debugging or when you need a compact representation of the name.
§Examples
use tnid::{DynamicTnid, NameStr};
let name = NameStr::new("test").unwrap();
let id = DynamicTnid::new_v1(name);
assert_eq!(id.name_hex(), "cab19");Sourcepub fn as_u128(&self) -> u128
pub fn as_u128(&self) -> u128
Returns the raw 128-bit UUIDv8-compatible representation of this TNID.
This returns the complete bit representation including the name, UUID version/variant
bits, and all data. This is the inverse of Self::from_u128.
§Examples
use tnid::{DynamicTnid, NameStr};
let name = NameStr::new("user").unwrap();
let id = DynamicTnid::new_v0(name);
let as_u128 = id.as_u128();
// Convert to big-endian bytes for storage/transmission
let bytes = as_u128.to_be_bytes();Sourcepub fn variant(&self) -> TnidVariant
pub fn variant(&self) -> TnidVariant
Returns the TNID variant.
§Examples
use tnid::{DynamicTnid, NameStr, TnidVariant};
let id_v0 = DynamicTnid::new_v0(NameStr::new("user").unwrap());
assert_eq!(id_v0.variant(), TnidVariant::V0);
let id_v1 = DynamicTnid::new_v1(NameStr::new("user").unwrap());
assert_eq!(id_v1.variant(), TnidVariant::V1);Sourcepub fn to_tnid_string(&self) -> String
pub fn to_tnid_string(&self) -> String
Converts the TNID to its string representation.
This is the human-readable, sortable format: <name>.<encoded-data>.
This is the inverse of Self::parse_tnid_string.
§Examples
use tnid::{DynamicTnid, NameStr};
let name = NameStr::new("user").unwrap();
let id = DynamicTnid::new_v0(name);
let tnid_string = id.to_tnid_string();
// Format: <name>.<encoded-data>
// Example: "user.Br2flcNDfF6LYICnT"
assert!(tnid_string.starts_with("user."));Sourcepub fn to_uuid_string(&self, case: Case) -> String
pub fn to_uuid_string(&self, case: Case) -> String
Converts the TNID to UUID hex string format.
This is useful for UUID compatibility and interoperability with systems that expect
UUID hex strings. This is the inverse of Self::parse_uuid_string.
§Examples
use tnid::{DynamicTnid, NameStr};
let name = NameStr::new("user").unwrap();
let id = DynamicTnid::new_v1(name);
use tnid::Case;
let uuid_lower = id.to_uuid_string(Case::Lower);
// "cab1952a-f09d-86d9-928e-96ea03dc6af3"
let uuid_upper = id.to_uuid_string(Case::Upper);
// "CAB1952A-F09D-86D9-928E-96EA03DC6AF3"Sourcepub fn to_bytes(&self) -> [u8; 16]
pub fn to_bytes(&self) -> [u8; 16]
Converts the TNID to its 16-byte big-endian representation.
This is useful for storing TNIDs in binary format or transmitting over the wire.
This is the inverse of Self::from_bytes.
§Examples
use tnid::{DynamicTnid, NameStr};
let name = NameStr::new("user").unwrap();
let id = DynamicTnid::new_v1(name);
let bytes = id.to_bytes();
assert_eq!(bytes.len(), 16);Sourcepub fn from_bytes(bytes: [u8; 16]) -> Result<Self, ParseTnidError>
pub fn from_bytes(bytes: [u8; 16]) -> Result<Self, ParseTnidError>
Creates a TNID from its 16-byte big-endian representation.
This is the inverse of Self::to_bytes and validates that the bytes represent
a valid TNID.
Returns Err if the bytes don’t represent a valid TNID (invalid UUID version/variant
bits or invalid name encoding).
§Examples
use tnid::{DynamicTnid, NameStr};
let name = NameStr::new("user").unwrap();
let original = DynamicTnid::new_v1(name);
let bytes = original.to_bytes();
let parsed = DynamicTnid::from_bytes(bytes).unwrap();
assert_eq!(parsed.as_u128(), original.as_u128());Sourcepub fn encrypt_v0_to_v1(
&self,
key: impl Into<EncryptionKey>,
) -> Result<Self, EncryptionError>
Available on crate feature encryption only.
pub fn encrypt_v0_to_v1( &self, key: impl Into<EncryptionKey>, ) -> Result<Self, EncryptionError>
encryption only.Encrypts a V0 TNID to a V1 TNID, hiding timestamp information.
See crate::Tnid::encrypt_v0_to_v1 for details on behavior and invariants.
Sourcepub fn decrypt_v1_to_v0(
&self,
key: impl Into<EncryptionKey>,
) -> Result<Self, EncryptionError>
Available on crate feature encryption only.
pub fn decrypt_v1_to_v0( &self, key: impl Into<EncryptionKey>, ) -> Result<Self, EncryptionError>
encryption only.Decrypts a V1 TNID back to a V0 TNID, recovering timestamp information.
See crate::Tnid::decrypt_v1_to_v0 for details on behavior and invariants.
Trait Implementations§
Source§impl Clone for DynamicTnid
impl Clone for DynamicTnid
Source§fn clone(&self) -> DynamicTnid
fn clone(&self) -> DynamicTnid
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DynamicTnid
impl Debug for DynamicTnid
Source§impl<'r> Decode<'r, MySql> for DynamicTnid
Available on crate feature sqlx-mysql and (crate features sqlx-postgres or sqlx-mysql or sqlx-sqlite) only.
impl<'r> Decode<'r, MySql> for DynamicTnid
sqlx-mysql and (crate features sqlx-postgres or sqlx-mysql or sqlx-sqlite) only.Source§fn decode(value: MySqlValueRef<'r>) -> Result<Self, BoxDynError>
fn decode(value: MySqlValueRef<'r>) -> Result<Self, BoxDynError>
Source§impl<'r> Decode<'r, Postgres> for DynamicTnid
Available on crate feature sqlx-postgres and (crate features sqlx-postgres or sqlx-mysql or sqlx-sqlite) only.
impl<'r> Decode<'r, Postgres> for DynamicTnid
sqlx-postgres and (crate features sqlx-postgres or sqlx-mysql or sqlx-sqlite) only.Source§fn decode(value: PgValueRef<'r>) -> Result<Self, BoxDynError>
fn decode(value: PgValueRef<'r>) -> Result<Self, BoxDynError>
Source§impl<'r> Decode<'r, Sqlite> for DynamicTnid
Available on crate feature sqlx-sqlite and (crate features sqlx-postgres or sqlx-mysql or sqlx-sqlite) only.
impl<'r> Decode<'r, Sqlite> for DynamicTnid
sqlx-sqlite and (crate features sqlx-postgres or sqlx-mysql or sqlx-sqlite) only.Source§fn decode(value: SqliteValueRef<'r>) -> Result<Self, BoxDynError>
fn decode(value: SqliteValueRef<'r>) -> Result<Self, BoxDynError>
Source§impl<'de> Deserialize<'de> for DynamicTnid
Available on crate feature serde only.
impl<'de> Deserialize<'de> for DynamicTnid
serde only.Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Source§impl Display for DynamicTnid
impl Display for DynamicTnid
Source§impl<'q> Encode<'q, MySql> for DynamicTnid
Available on crate feature sqlx-mysql and (crate features sqlx-postgres or sqlx-mysql or sqlx-sqlite) only.
impl<'q> Encode<'q, MySql> for DynamicTnid
sqlx-mysql and (crate features sqlx-postgres or sqlx-mysql or sqlx-sqlite) only.Source§fn encode_by_ref(&self, buf: &mut Vec<u8>) -> Result<IsNull, BoxDynError>
fn encode_by_ref(&self, buf: &mut Vec<u8>) -> Result<IsNull, BoxDynError>
Source§fn encode(
self,
buf: &mut <DB as Database>::ArgumentBuffer<'q>,
) -> Result<IsNull, Box<dyn Error + Send + Sync>>where
Self: Sized,
fn encode(
self,
buf: &mut <DB as Database>::ArgumentBuffer<'q>,
) -> Result<IsNull, Box<dyn Error + Send + Sync>>where
Self: Sized,
self into buf in the expected format for the database.fn produces(&self) -> Option<<DB as Database>::TypeInfo>
fn size_hint(&self) -> usize
Source§impl<'q> Encode<'q, Postgres> for DynamicTnid
Available on crate feature sqlx-postgres and (crate features sqlx-postgres or sqlx-mysql or sqlx-sqlite) only.
impl<'q> Encode<'q, Postgres> for DynamicTnid
sqlx-postgres and (crate features sqlx-postgres or sqlx-mysql or sqlx-sqlite) only.Source§fn encode_by_ref(
&self,
buf: &mut PgArgumentBuffer,
) -> Result<IsNull, BoxDynError>
fn encode_by_ref( &self, buf: &mut PgArgumentBuffer, ) -> Result<IsNull, BoxDynError>
Source§fn encode(
self,
buf: &mut <DB as Database>::ArgumentBuffer<'q>,
) -> Result<IsNull, Box<dyn Error + Send + Sync>>where
Self: Sized,
fn encode(
self,
buf: &mut <DB as Database>::ArgumentBuffer<'q>,
) -> Result<IsNull, Box<dyn Error + Send + Sync>>where
Self: Sized,
self into buf in the expected format for the database.fn produces(&self) -> Option<<DB as Database>::TypeInfo>
fn size_hint(&self) -> usize
Source§impl<'q> Encode<'q, Sqlite> for DynamicTnid
Available on crate feature sqlx-sqlite and (crate features sqlx-postgres or sqlx-mysql or sqlx-sqlite) only.
impl<'q> Encode<'q, Sqlite> for DynamicTnid
sqlx-sqlite and (crate features sqlx-postgres or sqlx-mysql or sqlx-sqlite) only.Source§fn encode_by_ref(
&self,
args: &mut Vec<SqliteArgumentValue<'q>>,
) -> Result<IsNull, BoxDynError>
fn encode_by_ref( &self, args: &mut Vec<SqliteArgumentValue<'q>>, ) -> Result<IsNull, BoxDynError>
Source§fn encode(
self,
buf: &mut <DB as Database>::ArgumentBuffer<'q>,
) -> Result<IsNull, Box<dyn Error + Send + Sync>>where
Self: Sized,
fn encode(
self,
buf: &mut <DB as Database>::ArgumentBuffer<'q>,
) -> Result<IsNull, Box<dyn Error + Send + Sync>>where
Self: Sized,
self into buf in the expected format for the database.fn produces(&self) -> Option<<DB as Database>::TypeInfo>
fn size_hint(&self) -> usize
Source§impl From<DynamicTnid> for UuidLike
impl From<DynamicTnid> for UuidLike
Source§fn from(dynamic: DynamicTnid) -> Self
fn from(dynamic: DynamicTnid) -> Self
Source§impl Hash for DynamicTnid
impl Hash for DynamicTnid
Source§impl Ord for DynamicTnid
impl Ord for DynamicTnid
Source§fn cmp(&self, other: &DynamicTnid) -> Ordering
fn cmp(&self, other: &DynamicTnid) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for DynamicTnid
impl PartialEq for DynamicTnid
Source§impl PartialOrd for DynamicTnid
impl PartialOrd for DynamicTnid
Source§impl PgHasArrayType for DynamicTnid
Available on crate feature sqlx-postgres and (crate features sqlx-postgres or sqlx-mysql or sqlx-sqlite) only.
impl PgHasArrayType for DynamicTnid
sqlx-postgres and (crate features sqlx-postgres or sqlx-mysql or sqlx-sqlite) only.fn array_type_info() -> PgTypeInfo
fn array_compatible(ty: &PgTypeInfo) -> bool
Source§impl Serialize for DynamicTnid
Available on crate feature serde only.
impl Serialize for DynamicTnid
serde only.Source§impl<Name: TnidName> TryFrom<DynamicTnid> for Tnid<Name>
impl<Name: TnidName> TryFrom<DynamicTnid> for Tnid<Name>
Source§type Error = ParseTnidError
type Error = ParseTnidError
Source§impl TryFrom<UuidLike> for DynamicTnid
impl TryFrom<UuidLike> for DynamicTnid
Source§impl Type<MySql> for DynamicTnid
Available on crate feature sqlx-mysql and (crate features sqlx-postgres or sqlx-mysql or sqlx-sqlite) only.
impl Type<MySql> for DynamicTnid
sqlx-mysql and (crate features sqlx-postgres or sqlx-mysql or sqlx-sqlite) only.Source§fn type_info() -> MySqlTypeInfo
fn type_info() -> MySqlTypeInfo
Source§fn compatible(ty: &MySqlTypeInfo) -> bool
fn compatible(ty: &MySqlTypeInfo) -> bool
Source§impl Type<Postgres> for DynamicTnid
Available on crate feature sqlx-postgres and (crate features sqlx-postgres or sqlx-mysql or sqlx-sqlite) only.
impl Type<Postgres> for DynamicTnid
sqlx-postgres and (crate features sqlx-postgres or sqlx-mysql or sqlx-sqlite) only.Source§impl Type<Sqlite> for DynamicTnid
Available on crate feature sqlx-sqlite and (crate features sqlx-postgres or sqlx-mysql or sqlx-sqlite) only.
impl Type<Sqlite> for DynamicTnid
sqlx-sqlite and (crate features sqlx-postgres or sqlx-mysql or sqlx-sqlite) only.Source§fn type_info() -> SqliteTypeInfo
fn type_info() -> SqliteTypeInfo
Source§fn compatible(ty: &SqliteTypeInfo) -> bool
fn compatible(ty: &SqliteTypeInfo) -> bool
impl Copy for DynamicTnid
impl Eq for DynamicTnid
impl StructuralPartialEq for DynamicTnid
Auto Trait Implementations§
impl Freeze for DynamicTnid
impl RefUnwindSafe for DynamicTnid
impl Send for DynamicTnid
impl Sync for DynamicTnid
impl Unpin for DynamicTnid
impl UnwindSafe for DynamicTnid
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more