mirror of
https://github.com/teloxide/teloxide.git
synced 2025-01-03 17:52:12 +01:00
Fix Clone
implementation for ErasedRequester
This commit is contained in:
parent
61d36e3ac9
commit
d3eb94b695
2 changed files with 15 additions and 1 deletions
|
@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
## unreleased
|
||||
|
||||
### Fixed
|
||||
|
||||
- `ErasedRequester<E>` now implements `Clone` even if `E` is not `Clone` ([#244][pr244])
|
||||
|
||||
[pr244]: https://github.com/teloxide/teloxide-core/pull/244
|
||||
|
||||
### Added
|
||||
|
||||
- `From<ApiError>`, `From<DownloadError>` and `From<std::io::Error>` impls for `RequestError` ([#241][pr241])
|
||||
|
|
|
@ -10,7 +10,6 @@ use crate::{
|
|||
};
|
||||
|
||||
/// [`Requester`] with erased type.
|
||||
#[derive(Clone)]
|
||||
pub struct ErasedRequester<'a, E> {
|
||||
inner: Arc<dyn ErasableRequester<'a, Err = E> + 'a>,
|
||||
}
|
||||
|
@ -37,6 +36,15 @@ impl<E> std::fmt::Debug for ErasedRequester<'_, E> {
|
|||
}
|
||||
}
|
||||
|
||||
// NB. hand-written impl to avoid `E: Clone` bound
|
||||
impl<E> Clone for ErasedRequester<'_, E> {
|
||||
fn clone(&self) -> Self {
|
||||
Self {
|
||||
inner: Arc::clone(&self.inner),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// [`Request`] with erased type.
|
||||
#[must_use = "Requests are lazy and do nothing unless sent"]
|
||||
pub struct ErasedRequest<'a, T, E> {
|
||||
|
|
Loading…
Reference in a new issue