pub struct LogoFetcher { /* private fields */ }Expand description
Fetches company logos using logo.dev API with caching and a circuit breaker.
This fetcher uses logo.dev’s API (https://logo.dev) which provides company logos
by ticker symbol. It constructs URLs like:
https://img.logo.dev/ticker/AAPL?token=...&format=png&fallback=404&size=50&theme=dark
The fetcher includes:
- In-memory caching with TTL
- Circuit breaker pattern to protect against service failures
- Configurable timeouts
Implementations§
Source§impl LogoFetcher
impl LogoFetcher
Sourcepub fn new(fetch_client: Arc<FetchClient>) -> Self
pub fn new(fetch_client: Arc<FetchClient>) -> Self
Create a new logo fetcher using the provided fetch client.
Environment variables:
DISABLE_LOGO_FETCHING: when “true”, skip all logo requests.LOGO_TIMEOUT_SECONDS: per-request timeout (default 2s).LOGO_CIRCUIT_BREAKER_THRESHOLD: failures before opening (default 5).LOGO_CIRCUIT_BREAKER_TIMEOUT: cooldown in seconds (default 300s).
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Returns whether logo fetching is enabled.
Trait Implementations§
Source§impl Clone for LogoFetcher
impl Clone for LogoFetcher
Source§fn clone(&self) -> LogoFetcher
fn clone(&self) -> LogoFetcher
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for LogoFetcher
impl !UnwindSafe for LogoFetcher
impl Freeze for LogoFetcher
impl Send for LogoFetcher
impl Sync for LogoFetcher
impl Unpin for LogoFetcher
impl UnsafeUnpin for LogoFetcher
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