[][src]Struct serbo::Manager

pub struct Manager { /* fields omitted */ }

Controls the creation and deleting of servers, and whether they are currently active.

Implementations

impl Manager[src]

pub fn new(
    server_files_folder: &str,
    version_folder: &str,
    jar_name: &str
) -> Manager
[src]

Creates a new server manager

Arguments

  • server_files_folder - the folder that will hold each server's folder, which contains its server files.
  • version_folder - the folder containing the base files of servers for the MC versions that you wish to host. Used as a base to create new servers.

Examples

  let manager = serbo::Manager::new("folder1","folder2");

Remarks

The version_folder should be a folder that contains folders that are named the same as the MC server files they contain.

pub fn create(&mut self, id: &str, version: &str) -> Result<(), Error>[src]

Creates a new MC server folder under the server_files_folder

Arguments

  • id - The id for the server
  • version - The target version for the server.
  • jar_name - The name of the jar file that should be executed to start the server.

Examples

let manager = serbo::Manager::new("folder1","folder2");
manager.create("1","1.16.1");

Remarks

Returns a result that contains the id that was assigned to the server

pub fn get(&mut self, id: &str) -> Option<&mut Instance>[src]

Returns an Option containing a Instance that represents the currently online server represented by the provided id

Arguments

  • id - The id that represents the requested server

Examples

let manager = serbo::Manager::new("folder1","folder2");
//Returns an Option
let instance:serbo::Instance = manager.get("1").unwrap();

Remarks

Queries the currently online servers, for get to return, must have been launched by calling start

pub fn exists(&mut self, id: &str) -> bool[src]

Checks if server files exist for a given id

Arguments

  • id - The id that represents the requested server

pub fn is_online(&mut self, id: &str) -> bool[src]

Checks if the server is online

Arguments

  • id - The id that represents the requested server

Remarks

Queries the currently online servers, must have been launched by calling start

pub fn start(&mut self, id: &str, port: u32) -> Result<u32, Error>[src]

Launches a server

Arguments

  • id - The id that represents the requested server
  • port - The port that the server should be started on

pub fn stop(&mut self, id: &str) -> Result<(), Error>[src]

Stops a server

Arguments

  • id - The id that represents the requested server

pub fn delete(&mut self, id: &str) -> Result<(), Error>[src]

Deletes a server's files

Arguments

  • id - The id that represents the requested server

Remarks

Stops the server if it's currently running

pub fn change_version(&mut self, id: &str, target: &str) -> Result<(), Error>[src]

Changes a server's version

Arguments

  • id - The id that represents the requested server
  • target - The target version to be switched to

Remarks

Stops the server if it's currently running

Auto Trait Implementations

impl !RefUnwindSafe for Manager

impl Send for Manager

impl Sync for Manager

impl Unpin for Manager

impl !UnwindSafe for Manager

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.