pub struct Inscription {
pub content_type: String,
pub data: Vec<u8>,
}Expand description
An inscription with a content type and data payload.
Encoded as an OP_FALSE OP_RETURN script with two data pushes: the content type string and the raw data.
Fields§
§content_type: String§data: Vec<u8>Implementations§
Source§impl Inscription
impl Inscription
Sourcepub fn new(content_type: &str, data: Vec<u8>) -> Self
pub fn new(content_type: &str, data: Vec<u8>) -> Self
Create a new inscription with the given content type and data.
Sourcepub fn to_script(&self) -> LockingScript
pub fn to_script(&self) -> LockingScript
Convert this inscription to a locking script.
Format: OP_FALSE OP_RETURN <content_type_bytes> <data_bytes>
Sourcepub fn from_script(script: &Script) -> Result<Self, ScriptError>
pub fn from_script(script: &Script) -> Result<Self, ScriptError>
Parse an inscription from a script.
Expected format: OP_FALSE/OP_0 OP_RETURN <content_type_data> <payload_data>
Trait Implementations§
Source§impl Clone for Inscription
impl Clone for Inscription
Source§fn clone(&self) -> Inscription
fn clone(&self) -> Inscription
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Inscription
impl Debug for Inscription
Source§impl PartialEq for Inscription
impl PartialEq for Inscription
impl Eq for Inscription
impl StructuralPartialEq for Inscription
Auto Trait Implementations§
impl Freeze for Inscription
impl RefUnwindSafe for Inscription
impl Send for Inscription
impl Sync for Inscription
impl Unpin for Inscription
impl UnsafeUnpin for Inscription
impl UnwindSafe for Inscription
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