pub struct ModpackMaker { /* private fields */ }Expand description
This struct is responsible for the creation of the modpacks given a minecraft path.
Implementations§
Source§impl ModpackMaker
impl ModpackMaker
pub fn new<I: AsRef<Path>, J: AsRef<Path>>( path: I, modpack_name: J, ) -> ModpackMaker
Sourcepub fn start(&mut self) -> Result<()>
pub fn start(&mut self) -> Result<()>
Starts the mod maker process.
This method initializes the mod maker, reads the mods, and prepares internal data structures for processing.
§Errors
This method can return an error of type UraniumError in the following
cases:
- If there is an error while reading the mods.
§Returns
This method returns Ok(()) if the mod maker was successfully started
and prepared for processing.
§Example
use uranium_rs::modpack_maker::ModpackMaker;
use uranium_rs::error::UraniumError;
let mut mod_maker = ModpackMaker::new("path/to/your/modpack", "my_modpack");
match mod_maker.start() {
Ok(()) => println!("Mod maker started successfully!"),
Err(err) => eprintln!("Error starting mod maker: {:?}", err),
}Sourcepub async fn finish(&mut self) -> Result<()>
pub async fn finish(&mut self) -> Result<()>
Finishes the mod maker process.
This asynchronous method continues processing chunks until the mod maker has completed its work.
§Errors
This method can return an error of type UraniumError if any error
occurs during the mod making process.
§Returns
This method returns Ok(()) if the mod maker has successfully completed
its work.
§Example
use uranium_rs::modpack_maker::ModpackMaker;
use uranium_rs::error::UraniumError;
let mut mod_maker = ModpackMaker::new("your/modpack/path", "my_modpack");
match mod_maker.finish().await {
Ok(()) => println!("Mod maker finished successfully!"),
Err(err) => eprintln!("Error finishing mod maker: {:?}", err),
}Sourcepub fn chunks(&self) -> usize
pub fn chunks(&self) -> usize
Returns how many chunks the struct will download
The formula is: self.len() / self.threads
Sourcepub async fn chunk(&mut self) -> Result<State>
pub async fn chunk(&mut self) -> Result<State>
This method will make progress until Ok(State::Finish) is returned
or throw an Err.
It will return the current State of the process.
§Errors
In case any of the steps fails this method will return
Err(UraniumError) with the cause.
Can return any of the following variants:
UraniumError::CantReadModsDirUraniumError::CantCompressUraniumError::CantRemoveJSON
Auto Trait Implementations§
impl Freeze for ModpackMaker
impl !RefUnwindSafe for ModpackMaker
impl Send for ModpackMaker
impl Sync for ModpackMaker
impl Unpin for ModpackMaker
impl !UnwindSafe for ModpackMaker
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more