pub struct DataPackBuilder { /* private fields */ }
Expand description
A DataPack builder
§Examples
use datapack::builder::DataPackBuilder;
use datapack::component::{Component, MCFunction};
use datapack::namespace::Namespace;
use std::fs::File;
let file = File::create("example.zip").unwrap();
DataPackBuilder::new()
.add_namespace(
Namespace::new("example")
.add_component(Component::Function(MCFunction::new("say hello world", "hello", true, false)))
).build(&file)
Implementations§
Source§impl DataPackBuilder
impl DataPackBuilder
Sourcepub fn set_pack_format(&mut self, pack_format: usize) -> &mut Self
pub fn set_pack_format(&mut self, pack_format: usize) -> &mut Self
Sets the “pack_format” in the pack.mcmeta
Sourcepub fn set_description(&mut self, description: &str) -> &mut Self
pub fn set_description(&mut self, description: &str) -> &mut Self
Sets the “description” in the pack.mcmeta
Sourcepub fn add_namespace(&mut self, namespace: &Namespace) -> &mut Self
pub fn add_namespace(&mut self, namespace: &Namespace) -> &mut Self
Adds a namespace to the pack
Auto Trait Implementations§
impl Freeze for DataPackBuilder
impl RefUnwindSafe for DataPackBuilder
impl Send for DataPackBuilder
impl Sync for DataPackBuilder
impl Unpin for DataPackBuilder
impl UnwindSafe for DataPackBuilder
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