Skip to main content

Book

Struct Book 

Source
pub struct Book {
Show 15 fields pub id: String, pub name: String, pub nameplate_color: String, pub landing_text: String, pub author: Option<String>, pub book_texture: String, pub filler_texture: String, pub model: String, pub categories: Vec<BookCategory>, pub entries: Vec<BookEntry>, pub macros: Vec<BookMacro>, pub use_resource_pack: bool, pub show_progress: bool, pub i18n: bool, pub creative_tab: Option<String>,
}
Expand description

The top-level book definition — replaces patchouli_books/<id>/book.json.

Fields§

§id: String§name: String§nameplate_color: String§landing_text: String§author: Option<String>§book_texture: String§filler_texture: String§model: String§categories: Vec<BookCategory>§entries: Vec<BookEntry>§macros: Vec<BookMacro>§use_resource_pack: bool§show_progress: bool§i18n: bool§creative_tab: Option<String>

Implementations§

Source§

impl Book

Source

pub fn new(id: impl Into<String>, name: impl Into<String>) -> Book

Source

pub fn author(self, author: impl Into<String>) -> Book

Source

pub fn book_texture(self, tex: impl Into<String>) -> Book

Source

pub fn filler_texture(self, tex: impl Into<String>) -> Book

Source

pub fn nameplate(self, color: impl Into<String>) -> Book

Source

pub fn landing_text(self, text: impl Into<String>) -> Book

Source

pub fn model(self, model: impl Into<String>) -> Book

Source

pub fn creative_tab(self, tab: impl Into<String>) -> Book

Source

pub fn show_progress(self, show: bool) -> Book

Source

pub fn i18n(self, val: bool) -> Book

Source

pub fn use_resource_pack(self, val: bool) -> Book

Source

pub fn add_macro(self, key: impl Into<String>, value: impl Into<String>) -> Book

Source

pub fn add_category(self, category: BookCategory) -> Book

Source

pub fn add_entry(self, entry: BookEntry) -> Book

Source§

impl Book

Source

pub fn to_json(&self) -> String

Trait Implementations§

Source§

impl Clone for Book

Source§

fn clone(&self) -> Book

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Book

Source§

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

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

impl Default for Book

Source§

fn default() -> Book

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

Auto Trait Implementations§

§

impl Freeze for Book

§

impl RefUnwindSafe for Book

§

impl Send for Book

§

impl Sync for Book

§

impl Unpin for Book

§

impl UnsafeUnpin for Book

§

impl UnwindSafe for Book

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.