Struct keeshond_datapack::source::FilesystemSource
source · [−]pub struct FilesystemSource { /* private fields */ }
Expand description
A Source that loads packages from the filesystem. This is a good source to use for development, or if you don’t care about packaging your data files into an archive.
Implementations
sourceimpl FilesystemSource
impl FilesystemSource
sourcepub fn new(directory: &str, trust: TrustLevel) -> FilesystemSource
pub fn new(directory: &str, trust: TrustLevel) -> FilesystemSource
Creates a new FilesystemSource using the given directory to look for packages in
Trait Implementations
sourceimpl Source for FilesystemSource
impl Source for FilesystemSource
sourcefn get_uri(&self) -> &str
fn get_uri(&self) -> &str
The path that this Source originates from. Only used for debug purposes.
sourcefn has_package(&self, package_name: &str) -> bool
fn has_package(&self, package_name: &str) -> bool
Returns true if the Source has a package of the given name, otherwise returns false
sourcefn list_packages(&mut self) -> Vec<String>
fn list_packages(&mut self) -> Vec<String>
Returns a list of all packages available in this Source. Do not call this repeatedly!
sourcefn read_file<'a>(
&'a mut self,
package_name: &str,
pathname: &str
) -> Result<Box<dyn ReadSeek + 'a>, PackageError>
fn read_file<'a>(
&'a mut self,
package_name: &str,
pathname: &str
) -> Result<Box<dyn ReadSeek + 'a>, PackageError>
sourcefn write_file<'a>(
&'a mut self,
package_name: &str,
pathname: &str
) -> Result<Box<dyn Write + 'a>, PackageError>
fn write_file<'a>(
&'a mut self,
package_name: &str,
pathname: &str
) -> Result<Box<dyn Write + 'a>, PackageError>
Returns a Write for the file at the given pathname.
sourcefn iter_entries<'a>(
&'a mut self,
package_name: &str,
type_folder: &str
) -> Box<dyn Iterator<Item = Result<String, PackageError>> + 'a>
fn iter_entries<'a>(
&'a mut self,
package_name: &str,
type_folder: &str
) -> Box<dyn Iterator<Item = Result<String, PackageError>> + 'a>
Returns an iterator through the items in a given package, if the Source has said package
sourcefn trust_level(&self, _package_name: &str) -> TrustLevel
fn trust_level(&self, _package_name: &str) -> TrustLevel
Returns the source’s trust level for the given package. Trusted sources are able to load resource types marked as requiring trust. Read more
Auto Trait Implementations
impl RefUnwindSafe for FilesystemSource
impl Send for FilesystemSource
impl Sync for FilesystemSource
impl Unpin for FilesystemSource
impl UnwindSafe for FilesystemSource
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: Any,
sourcefn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Convert Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
. Read more
sourcefn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more
sourcefn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert &Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read more
sourcefn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert &mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read more