pub struct Classpath { /* private fields */ }
Expand description
A classpath in java
Implementations§
Source§impl Classpath
impl Classpath
Sourcepub fn as_os_string(&self) -> OsString
pub fn as_os_string(&self) -> OsString
Converts this classpath into a usable classpath for java
§Example
let cp = Classpath::from_iter(["file1", "file2", "file3"]);
assert_eq!(cp.as_os_string(), OsString::from(format!("file1{0}file2{0}file3", CLASSPATH_SEPARATOR)));
Sourcepub fn get<P: AsRef<str>>(&self, path: P) -> Option<Result<Resource>>
pub fn get<P: AsRef<str>>(&self, path: P) -> Option<Result<Resource>>
Attempts to get a resource on the classpath.
Paths will be interpreted with only /
as a separator. A leading /
is ignored.
§Return
Will return None
is path is not on classpath. Otherwise, Some(Result)
is returned
where the resource exists. The result is Ok
if the inner is actually readable.
§Example
let cp = Classpath::from_str("run.jar");
let resource = cp.get("META-INF/MANIFEST").expect("manifest not found");
Trait Implementations§
Source§impl AddAssign for Classpath
impl AddAssign for Classpath
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Performs the
+=
operation. Read moreSource§impl<P: AsRef<Path>> Extend<P> for Classpath
impl<P: AsRef<Path>> Extend<P> for Classpath
Source§fn extend<T: IntoIterator<Item = P>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = P>>(&mut self, iter: T)
Extends a collection with the contents of an iterator. Read more
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one
)Extends a collection with exactly one element.
Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
Source§impl<P> FromIterator<P> for Classpath
impl<P> FromIterator<P> for Classpath
Source§fn from_iter<T: IntoIterator<Item = P>>(iter: T) -> Self
fn from_iter<T: IntoIterator<Item = P>>(iter: T) -> Self
Creates a value from an iterator. Read more
Source§impl<'a> IntoIterator for &'a Classpath
impl<'a> IntoIterator for &'a Classpath
Source§impl IntoIterator for Classpath
impl IntoIterator for Classpath
impl Eq for Classpath
impl StructuralPartialEq for Classpath
Auto Trait Implementations§
impl Freeze for Classpath
impl RefUnwindSafe for Classpath
impl Send for Classpath
impl Sync for Classpath
impl Unpin for Classpath
impl UnwindSafe for Classpath
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