Struct cardano_serialization_lib::AssetName
source · pub struct AssetName(_);
Implementations§
source§impl AssetName
impl AssetName
pub fn from_bytes(bytes: Vec<u8>) -> Result<AssetName, DeserializeError>
source§impl AssetName
impl AssetName
sourcepub fn new(name: Vec<u8>) -> Result<AssetName, JsError>
pub fn new(name: Vec<u8>) -> Result<AssetName, JsError>
Examples found in repository?
src/lib.rs (line 3224)
3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::de::Deserializer<'de>,
{
let s = <String as serde::de::Deserialize>::deserialize(deserializer)?;
if let Ok(bytes) = hex::decode(&s) {
if let Ok(asset_name) = AssetName::new(bytes) {
return Ok(asset_name);
}
}
Err(serde::de::Error::invalid_value(
serde::de::Unexpected::Str(&s),
&"AssetName as hex string e.g. F8AB28C2",
))
}
pub fn name(&self) -> Vec<u8>
Trait Implementations§
source§impl<'de> Deserialize<'de> for AssetName
impl<'de> Deserialize<'de> for AssetName
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 AssetName
impl Deserialize for AssetName
fn deserialize<R: BufRead + Seek>(
raw: &mut Deserializer<R>
) -> Result<Self, DeserializeError>
source§impl JsonSchema for AssetName
impl JsonSchema for AssetName
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 AssetName
impl Ord for AssetName
source§impl PartialEq<AssetName> for AssetName
impl PartialEq<AssetName> for AssetName
source§impl PartialOrd<AssetName> for AssetName
impl PartialOrd<AssetName> for AssetName
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