pub struct AssetPayload {
pub name: AssetName,
pub sha256: String,
pub content_type: AssetContentType,
pub bytes: Option<Vec<u8>>,
}Expand description
One asset a create or an update carries to a destination.
bytes is base64 over the out-of-process protocol and the raw bytes in process. It is
absent exactly when the destination’s existing AssetUploads records this name with
this sha256: the destination already serves those bytes, so nothing is sent again.
Fields§
§name: AssetNameIts name, which the record’s content references as ./<name>.
sha256: StringThe lowercase hex SHA-256 of its bytes.
content_type: AssetContentTypeThe content type its extension gives it.
bytes: Option<Vec<u8>>Its bytes, or absent when the destination already records them by sha256.
Implementations§
Source§impl AssetPayload
impl AssetPayload
Sourcepub fn checked(&self) -> Result<(), SourceError>
pub fn checked(&self) -> Result<(), SourceError>
Refuse a payload whose content type is not the one its name’s extension gives it, or whose bytes, when it carries them, do not hash to its digest — the check every source receiving one makes before it stores anything.
§Errors
SourceError::Refused naming the asset and what disagrees.
Trait Implementations§
Source§impl Clone for AssetPayload
impl Clone for AssetPayload
Source§impl Debug for AssetPayload
impl Debug for AssetPayload
Source§impl<'de> Deserialize<'de> for AssetPayload
impl<'de> Deserialize<'de> for AssetPayload
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>,
impl Eq for AssetPayload
Source§impl JsonSchema for AssetPayload
impl JsonSchema for AssetPayload
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read more