Skip to main content

JavaLocatorError

Struct JavaLocatorError 

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

Error type for Java locator operations.

This error type encapsulates various errors that can occur when locating or working with Java installations.

§Examples

use java_manager::JavaLocatorError;

let error = JavaLocatorError::new("Java not found".to_string());
println!("Error: {}", error);

Implementations§

Source§

impl JavaLocatorError

Source

pub fn description(&self) -> &str

Returns the error description.

§Returns

Error description string

§Examples
use java_manager::JavaLocatorError;

let error = JavaLocatorError::new("Test error".to_string());
assert_eq!(error.description(), "Test error");
Source

pub fn java_not_found() -> Self

Creates an error indicating Java is not installed or not in PATH.

§Returns

A JavaLocatorError with appropriate message

§Examples
use java_manager::JavaLocatorError;

let error = JavaLocatorError::java_not_found();
Source

pub fn file_not_found(file_name: &str, java_home: &str) -> Self

Creates an error indicating a file was not found in the Java installation.

§Arguments
  • file_name - Name of the file that was not found
  • java_home - Java home directory where the file was searched
§Returns

A JavaLocatorError with appropriate message

§Examples
use java_manager::JavaLocatorError;

let error = JavaLocatorError::file_not_found("libjsig.so", "/usr/lib/jvm/java-11");
Source

pub fn command_failed(command: &str, error: &str) -> Self

Creates an error indicating a command execution failure.

§Arguments
  • command - Command that failed
  • error - Underlying error
§Returns

A JavaLocatorError with appropriate message

§Examples
use java_manager::JavaLocatorError;

let error = JavaLocatorError::command_failed("java -version", "Permission denied");
Source

pub fn invalid_installation(path: &str, reason: &str) -> Self

Creates an error indicating an invalid Java installation.

§Arguments
  • path - Path to the invalid Java installation
  • reason - Reason why the installation is invalid
§Returns

A JavaLocatorError with appropriate message

§Examples
use java_manager::JavaLocatorError;

let error = JavaLocatorError::invalid_installation("/invalid/path", "Executable not found");
Source

pub fn invalid_utf8_path(path: &str) -> Self

Creates an error indicating an invalid UTF-8 sequence in a path.

§Arguments
  • path - Path that contains invalid UTF-8
§Returns

A JavaLocatorError with appropriate message

§Examples
use java_manager::JavaLocatorError;

let error = JavaLocatorError::invalid_utf8_path("<invalid-utf8-path>");

Trait Implementations§

Source§

impl Debug for JavaLocatorError

Source§

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

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

impl Display for JavaLocatorError

Source§

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

Formats the error for display.

§Arguments
  • f - Formatter
§Returns

Formatter result

Source§

impl Error for JavaLocatorError

Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()

Returns the error description (for compatibility with std::error::Error).

§Returns

Error description

Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting

Returns the cause of the error (if any).

§Returns

None (this error doesn’t wrap other errors)

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Provides source of the error (for compatibility with Rust 1.30+).

§Returns

None (this error doesn’t wrap other errors)

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<Error> for JavaLocatorError

Source§

fn from(err: Error) -> JavaLocatorError

Converts a std::io::Error to a JavaLocatorError.

§Arguments
  • err - IO error to convert
§Returns

A JavaLocatorError with the IO error description

Source§

impl From<PatternError> for JavaLocatorError

Source§

fn from(err: PatternError) -> JavaLocatorError

Converts a glob::PatternError to a JavaLocatorError.

§Arguments
  • err - Glob pattern error to convert
§Returns

A JavaLocatorError with the glob error description

Source§

impl From<Utf8Error> for JavaLocatorError

Source§

fn from(err: Utf8Error) -> JavaLocatorError

Converts a std::str::Utf8Error to a JavaLocatorError.

§Arguments
  • err - UTF-8 error to convert
§Returns

A JavaLocatorError with the UTF-8 error description

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.