Struct cardano_serialization_lib::NetworkId
source · pub struct NetworkId(_);
Implementations§
source§impl NetworkId
impl NetworkId
pub fn from_bytes(bytes: Vec<u8>) -> Result<NetworkId, DeserializeError>
source§impl NetworkId
impl NetworkId
sourcepub fn testnet() -> Self
pub fn testnet() -> Self
Examples found in repository?
src/serialization.rs (line 4911)
4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920
fn deserialize<R: BufRead + Seek>(raw: &mut Deserializer<R>) -> Result<Self, DeserializeError> {
(|| -> Result<_, DeserializeError> {
match raw.unsigned_integer()? {
0 => Ok(NetworkId::testnet()),
1 => Ok(NetworkId::mainnet()),
_ => Err(DeserializeError::new(
"NetworkId",
DeserializeFailure::NoVariantMatched.into(),
)),
}
})()
.map_err(|e| e.annotate("NetworkId"))
}
sourcepub fn mainnet() -> Self
pub fn mainnet() -> Self
Examples found in repository?
src/serialization.rs (line 4912)
4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920
fn deserialize<R: BufRead + Seek>(raw: &mut Deserializer<R>) -> Result<Self, DeserializeError> {
(|| -> Result<_, DeserializeError> {
match raw.unsigned_integer()? {
0 => Ok(NetworkId::testnet()),
1 => Ok(NetworkId::mainnet()),
_ => Err(DeserializeError::new(
"NetworkId",
DeserializeFailure::NoVariantMatched.into(),
)),
}
})()
.map_err(|e| e.annotate("NetworkId"))
}
pub fn kind(&self) -> NetworkIdKind
Trait Implementations§
source§impl<'de> Deserialize<'de> for NetworkId
impl<'de> Deserialize<'de> for NetworkId
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>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Deserialize for NetworkId
impl Deserialize for NetworkId
fn deserialize<R: BufRead + Seek>(
raw: &mut Deserializer<R>
) -> Result<Self, DeserializeError>
source§impl JsonSchema for NetworkId
impl JsonSchema for NetworkId
source§fn schema_name() -> String
fn schema_name() -> String
The name of the generated JSON Schema. Read more
source§fn json_schema(gen: &mut SchemaGenerator) -> Schema
fn json_schema(gen: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
Whether JSON Schemas generated for this type should be re-used where possible using the
$ref
keyword. Read moresource§impl Ord for NetworkId
impl Ord for NetworkId
source§impl PartialEq<NetworkId> for NetworkId
impl PartialEq<NetworkId> for NetworkId
source§impl PartialOrd<NetworkId> for NetworkId
impl PartialOrd<NetworkId> for NetworkId
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read more