pub struct PartFields { /* private fields */ }Expand description
The complete owned field set of a Part.
Fields are independent of kind. None and Some(empty) remain distinct.
use reef_core::opaque;
use reef_core::value::content;
let fields = content::PartFields::new(
"body".into(), "text/custom".into(), Some(Vec::new().into_boxed_slice()),
"ref".into(), Some(content::Metadata::new()), Some(opaque::Payload::from_vec(vec![])),
);
let part = content::Part::new(content::PartKind::from_i64(77), fields);
assert_eq!(part.kind().as_i64(), 77);
assert_eq!(part.fields().text(), "body");
assert_eq!(part.fields().data(), Some([].as_slice()));Implementations§
Source§impl PartFields
impl PartFields
Sourcepub const fn new(
text: String,
mime: String,
data: Option<Box<[u8]>>,
reference: String,
metadata: Option<Metadata>,
raw: Option<Payload>,
) -> Self
pub const fn new( text: String, mime: String, data: Option<Box<[u8]>>, reference: String, metadata: Option<Metadata>, raw: Option<Payload>, ) -> Self
Creates the complete field set without kind-dependent rewriting.
Sourcepub fn data(&self) -> Option<&[u8]>
pub fn data(&self) -> Option<&[u8]>
Returns the optional byte data while retaining its presence state.
Sourcepub const fn raw_payload(&self) -> Option<&Payload>
pub const fn raw_payload(&self) -> Option<&Payload>
Returns the optional opaque provider payload.
Trait Implementations§
Source§impl Clone for PartFields
impl Clone for PartFields
Source§impl Debug for PartFields
impl Debug for PartFields
Source§fn fmt(&self, formatter: &mut Formatter<'_>) -> Result
fn fmt(&self, formatter: &mut Formatter<'_>) -> Result
Sizes every model-visible field and keeps every presence distinction.
None, Some(<0 bytes>) and Some(<7 bytes>) stay three different
renderings, because the distinction between absent and present-empty is
the thing this type exists to carry.
Source§impl<'de> Deserialize<'de> for PartFields
impl<'de> Deserialize<'de> for PartFields
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
Auto Trait Implementations§
impl Freeze for PartFields
impl RefUnwindSafe for PartFields
impl Send for PartFields
impl Sync for PartFields
impl Unpin for PartFields
impl UnsafeUnpin for PartFields
impl UnwindSafe for PartFields
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