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
Source§impl JsonSchema for JsonBytes
impl JsonSchema for JsonBytes
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 moreimpl Eq for JsonBytes
impl 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 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)