-
Notifications
You must be signed in to change notification settings - Fork 118
Change client::*::from_stub() should accept Into<Arc<T>> #2146
Copy link
Copy link
Open
Labels
priority: p3Desirable enhancement or fix. May not be included in next release.Desirable enhancement or fix. May not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.‘Nice-to-have’ improvement, new feature or different behavior or design.
Description
This is a non-breaking change to make the from_stub constructor for client. We can make it more usable if it accepts Into<Arc<T>>:
use std::sync::Arc;
pub struct Foo<T> {
inner: Arc<T>
}
impl<T> Foo<T> {
pub fn from<U>(v: U) -> Self
where U: Into<Arc<T>> {
Self { inner: v.into() }
}
pub fn use_inner(&self) -> T where T: Clone {
(*self.inner).clone()
}
}
pub fn from_str(a: String) -> Foo<String> {
Foo::from(a)
}
pub fn from_arc(a: Arc<String>) -> Foo<String> {
Foo::from(a)
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
priority: p3Desirable enhancement or fix. May not be included in next release.Desirable enhancement or fix. May not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.‘Nice-to-have’ improvement, new feature or different behavior or design.