pub struct JsonBytes(/* private fields */);Expand description
Variable-length binary encoded as a 0x-prefixed hex string in JSON.
§Example
| JSON | Binary |
|---|---|
| “0x” | Empty binary |
| “0x00” | Single byte 0 |
| “0x636b62” | 3 bytes, UTF-8 encoding of ckb |
| “00” | Invalid, 0x is required |
| “0x0” | Invalid, each byte requires 2 digits |
Implementations§
Source§impl JsonBytes
impl JsonBytes
Sourcepub fn from_bytes(bytes: Bytes) -> Self
pub fn from_bytes(bytes: Bytes) -> Self
Creates the JsonBytes from Bytes.
Sourcepub fn into_bytes(self) -> Bytes
pub fn into_bytes(self) -> Bytes
Converts into Bytes.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for JsonBytes
impl<'de> Deserialize<'de> for JsonBytes
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
impl Eq for JsonBytes
Source§impl JsonSchema for JsonBytes
impl JsonSchema for JsonBytes
Source§fn json_schema(generate: &mut SchemaGenerator) -> Schema
fn json_schema(generate: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreimpl StructuralPartialEq for JsonBytes
Auto Trait Implementations§
impl !Freeze for JsonBytes
impl RefUnwindSafe for JsonBytes
impl Send for JsonBytes
impl Sync for JsonBytes
impl Unpin for JsonBytes
impl UnsafeUnpin for JsonBytes
impl UnwindSafe for JsonBytes
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
Mutably borrows from an owned value. Read more