pub enum FontError {
Network(Error),
Deserialize(Error),
CacheDir(StringError),
CacheFile(Error),
}Expand description
An error that can occur while using the google-fonts crate.
This enum represents various errors that can be encountered while downloading, deserializing, caching, or otherwise handling fonts from Google Fonts. Each variant corresponds to a specific type of error that can occur during the process.
§Variants
Network: Indicates an error that occurred while making a network request.Deserialize: Indicates an error that occurred while deserializing JSON data.CacheDir: Indicates an error that occurred while interacting with the cache directory.CacheFile: Indicates an error that occurred while interacting with a cache file.
Variants§
Network(Error)
An error that occurred while making a network request.
This variant wraps a reqwest::Error, which provides more details
about the specific network-related error that occurred.
§Example
use google_fonts::FontError;
if let FontError::Network(e) = error {
println!("Network error: {}", e);
}Deserialize(Error)
An error that occurred while deserializing JSON data.
This variant wraps a serde_json::Error, which provides more details
about the specific deserialization error that occurred.
§Example
use google_fonts::FontError;
if let FontError::Deserialize(e) = error {
println!("Deserialization error: {}", e);
}CacheDir(StringError)
An error that occurred while interacting with the cache directory.
This variant wraps a StringError, which provides more details
about the specific error related to the cache directory.
§Example
use google_fonts::FontError;
if let FontError::CacheDir(e) = error {
println!("Cache directory error: {}", e);
}CacheFile(Error)
An error that occurred while interacting with a cache file.
This variant wraps a std::io::Error, which provides more details
about the specific I/O error that occurred.
§Example
use google_fonts::FontError;
if let FontError::CacheFile(e) = error {
println!("Cache file error: {}", e);
}Trait Implementations§
Source§impl Error for FontError
impl Error for FontError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
Auto Trait Implementations§
impl Freeze for FontError
impl !RefUnwindSafe for FontError
impl Send for FontError
impl Sync for FontError
impl Unpin for FontError
impl !UnwindSafe for FontError
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.