[−][src]Struct filemagic::Magic
Configuration of which Flags
and magic databases to use
Implementations
impl Magic
[src]
pub fn error(&self) -> Option<String>
[src]
Returns a textual explanation of the last error, if any
You should not need to call this, since you can use the FileMagicError
in
the Result
returned by the other functions.
pub fn file<P: AsRef<Path>>(
&self,
filename: P
) -> Result<String, FileMagicError>
[src]
&self,
filename: P
) -> Result<String, FileMagicError>
Returns a textual description of the contents of the filename
pub fn buffer(&self, buffer: &[u8]) -> Result<String, FileMagicError>
[src]
Returns a textual description of the contents of the buffer
pub fn check<P: AsRef<Path>>(
&self,
filenames: &[P]
) -> Result<(), FileMagicError>
[src]
&self,
filenames: &[P]
) -> Result<(), FileMagicError>
Check the validity of entries in the database filenames
pub fn compile<P: AsRef<Path>>(
&self,
filenames: &[P]
) -> Result<(), FileMagicError>
[src]
&self,
filenames: &[P]
) -> Result<(), FileMagicError>
Compiles the given database filenames
for faster access
The compiled files created are named from the basename
of each file argument with '.mgc' appended to it.
pub fn list<P: AsRef<Path>>(
&self,
filenames: &[P]
) -> Result<(), FileMagicError>
[src]
&self,
filenames: &[P]
) -> Result<(), FileMagicError>
Dumps all magic entries in the given database filenames
in a human readable format
pub fn set_flags(&self, flags: Flags) -> bool
[src]
Sets the flags to use
Overwrites any previously set flags, e.g. those from load()
.
pub fn open(flags: Flags) -> Result<Magic, FileMagicError>
[src]
Creates a new configuration, flags
specify how other functions should behave
This does not load()
any databases yet.
pub fn load<P: AsRef<Path>>(
&self,
magic_databases: &[P]
) -> Result<(), FileMagicError>
[src]
&self,
magic_databases: &[P]
) -> Result<(), FileMagicError>
Loads the given database filenames
for further queries
Adds '.mgc' to the database files as appropriate.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Magic
[src]
impl !Send for Magic
[src]
impl !Sync for Magic
[src]
impl Unpin for Magic
[src]
impl UnwindSafe for Magic
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,