pub struct Card {
pub header: CardHeader,
pub metadata: CardMetadata,
pub payload: Vec<u8>,
}Use GenericCard with your own CardFormat instead
Expand description
A DataCard: BytePunch-compressed CML document with metadata
Fields§
§header: CardHeaderUse GenericCard with your own CardFormat instead
Card header
metadata: CardMetadataUse GenericCard with your own CardFormat instead
Document metadata
payload: Vec<u8>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>
Use GenericCard with your own CardFormat instead
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>
Use GenericCard with your own CardFormat instead
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>
Use GenericCard with your own CardFormat instead
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>
Use GenericCard with your own CardFormat instead
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>
Use GenericCard with your own CardFormat instead
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>
Use GenericCard with your own CardFormat instead
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<()>
Use GenericCard with your own CardFormat instead
Save card to file
Sourcepub fn calculate_checksum(&self) -> u32
👎Deprecated: Use GenericCard with your own CardFormat instead
pub fn calculate_checksum(&self) -> u32
Use GenericCard with your own CardFormat instead
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>>
Use GenericCard with your own CardFormat instead
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>
Use GenericCard with your own CardFormat instead
Deserialize card from bytes
Sourcepub fn compressed_size(&self) -> usize
👎Deprecated: Use GenericCard with your own CardFormat instead
pub fn compressed_size(&self) -> usize
Use GenericCard with your own CardFormat instead
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>
Use GenericCard with your own CardFormat instead
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>
Use GenericCard with your own CardFormat instead
Get compression ratio (original / compressed)
Sourcepub fn id(&self) -> &str
👎Deprecated: Use GenericCard with your own CardFormat instead
pub fn id(&self) -> &str
Use GenericCard with your own CardFormat instead
Get document ID
Sourcepub fn profile(&self) -> Option<&str>
👎Deprecated: Use GenericCard with your own CardFormat instead
pub fn profile(&self) -> Option<&str>
Use GenericCard with your own CardFormat instead
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
Use GenericCard with your own CardFormat instead
Check if card has checksum