ContentMetadataBuilder

Struct ContentMetadataBuilder 

Source
pub struct ContentMetadataBuilder { /* private fields */ }
Expand description

Builder for ContentMetadata.

Implementations§

Source§

impl ContentMetadataBuilder

Source

pub fn new() -> Self

Create a new builder.

Source

pub fn id(self, id: Uuid) -> Self

Set the ID (auto-generated if not set).

Source

pub fn cid(self, cid: impl Into<String>) -> Self

Set the CID.

Source

pub fn title(self, title: impl Into<String>) -> Self

Set the title.

Source

pub fn description(self, description: impl Into<String>) -> Self

Set the description.

Source

pub fn category(self, category: ContentCategory) -> Self

Set the category.

Source

pub fn tags(self, tags: Vec<String>) -> Self

Set the tags.

Source

pub fn add_tag(self, tag: impl Into<String>) -> Self

Add a tag.

Source

pub fn size_bytes(self, size: Bytes) -> Self

Set the size in bytes.

Source

pub fn chunk_count(self, count: u64) -> Self

Set the chunk count (auto-calculated if not set).

Source

pub fn price(self, price: Points) -> Self

Set the price.

Source

pub fn creator_id(self, creator_id: Uuid) -> Self

Set the creator ID.

Source

pub fn status(self, status: ContentStatus) -> Self

Set the status.

Source

pub fn preview_images(self, images: Vec<String>) -> Self

Set preview images.

Source

pub fn build(self) -> Result<ContentMetadata, &'static str>

Build the ContentMetadata.

§Errors

Returns error if required fields (cid, title) are missing

Trait Implementations§

Source§

impl Debug for ContentMetadataBuilder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ContentMetadataBuilder

Source§

fn default() -> ContentMetadataBuilder

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.