pub struct Card {
pub header: CardHeader,
pub metadata: CardMetadata,
pub payload: Vec<u8>,
}👎Deprecated: Use GenericCard with your own CardFormat instead
Expand description
A DataCard: BytePunch-compressed CML document with metadata
Fields§
§header: CardHeader👎Deprecated: Use GenericCard with your own CardFormat instead
Card header
metadata: CardMetadata👎Deprecated: Use GenericCard with your own CardFormat instead
Document metadata
payload: Vec<u8>👎Deprecated: Use GenericCard with your own CardFormat instead
Compressed CML data
Implementations§
Source§impl Card
impl Card
Sourcepub fn from_cml(
cml: &str,
metadata: CardMetadata,
dictionary: &Dictionary,
) -> Result<Self>
👎Deprecated: Use GenericCard with your own CardFormat instead
pub fn from_cml( cml: &str, metadata: CardMetadata, dictionary: &Dictionary, ) -> Result<Self>
Create a card from CML content
Sourcepub fn from_cml_with_checksum(
cml: &str,
metadata: CardMetadata,
dictionary: &Dictionary,
) -> Result<Self>
👎Deprecated: Use GenericCard with your own CardFormat instead
pub fn from_cml_with_checksum( cml: &str, metadata: CardMetadata, dictionary: &Dictionary, ) -> Result<Self>
Create a card from CML content with checksum
Sourcepub fn from_compressed(metadata: CardMetadata, payload: Vec<u8>) -> Result<Self>
👎Deprecated: Use GenericCard with your own CardFormat instead
pub fn from_compressed(metadata: CardMetadata, payload: Vec<u8>) -> Result<Self>
Create card from pre-compressed data
Sourcepub fn from_compressed_with_checksum(
metadata: CardMetadata,
payload: Vec<u8>,
) -> Result<Self>
👎Deprecated: Use GenericCard with your own CardFormat instead
pub fn from_compressed_with_checksum( metadata: CardMetadata, payload: Vec<u8>, ) -> Result<Self>
Create card from pre-compressed data with checksum
Sourcepub fn to_cml(&self, dictionary: &Dictionary) -> Result<String>
👎Deprecated: Use GenericCard with your own CardFormat instead
pub fn to_cml(&self, dictionary: &Dictionary) -> Result<String>
Decompress card back to CML content
Sourcepub fn load<P: AsRef<Path>>(path: P) -> Result<Self>
👎Deprecated: Use GenericCard with your own CardFormat instead
pub fn load<P: AsRef<Path>>(path: P) -> Result<Self>
Load card from file
Sourcepub fn save<P: AsRef<Path>>(&self, path: P) -> Result<()>
👎Deprecated: Use GenericCard with your own CardFormat instead
pub fn save<P: AsRef<Path>>(&self, path: P) -> Result<()>
Save card to file
Sourcepub fn calculate_checksum(&self) -> u32
👎Deprecated: Use GenericCard with your own CardFormat instead
pub fn calculate_checksum(&self) -> u32
Calculate CRC32 checksum for this card
Sourcepub fn to_bytes(&self) -> Result<Vec<u8>>
👎Deprecated: Use GenericCard with your own CardFormat instead
pub fn to_bytes(&self) -> Result<Vec<u8>>
Serialize card to bytes
Sourcepub fn from_bytes(data: &[u8]) -> Result<Self>
👎Deprecated: Use GenericCard with your own CardFormat instead
pub fn from_bytes(data: &[u8]) -> Result<Self>
Deserialize card from bytes
Sourcepub fn compressed_size(&self) -> usize
👎Deprecated: Use GenericCard with your own CardFormat instead
pub fn compressed_size(&self) -> usize
Get compressed size in bytes
Sourcepub fn original_size(&self) -> Option<u64>
👎Deprecated: Use GenericCard with your own CardFormat instead
pub fn original_size(&self) -> Option<u64>
Get original size if available
Sourcepub fn compression_ratio(&self) -> Option<f64>
👎Deprecated: Use GenericCard with your own CardFormat instead
pub fn compression_ratio(&self) -> Option<f64>
Get compression ratio (original / compressed)
Sourcepub fn id(&self) -> &str
👎Deprecated: Use GenericCard with your own CardFormat instead
pub fn id(&self) -> &str
Get document ID
Sourcepub fn profile(&self) -> Option<&str>
👎Deprecated: Use GenericCard with your own CardFormat instead
pub fn profile(&self) -> Option<&str>
Get CML profile if set
Sourcepub fn has_checksum(&self) -> bool
👎Deprecated: Use GenericCard with your own CardFormat instead
pub fn has_checksum(&self) -> bool
Check if card has checksum
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Card
impl RefUnwindSafe for Card
impl Send for Card
impl Sync for Card
impl Unpin for Card
impl UnwindSafe for Card
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