В
Size: a a a
В
Ct
let mut last = None;
while let next @ Some(_) = lines.next().await { last = next }D
Ct
last() на итераторе таки есть.D
D
D
fn last(self) -> Option<Self::Item>
where
Self: Sized,
{
#[inline]
fn some<T>(_: Option<T>, x: T) -> Option<T> {
Some(x)
}
self.fold(None, some)
}
D
AI
M
K
K
D
AK
pub struct DI {
services: HashMap<TypeId, Arc<dyn Any + Send + Sync>>,
params: HashMap<String, Arc<dyn Any + Send + Sync>>,
}context
.di
.service::<AuthService>()
.login(&username, &password)
pub fn service<T: 'static + Send + Sync + Dependency>(&self) -> Arc<T> {
self.services
.get(&TypeId::of::<T>())
.unwrap_or_else(|| panic!(format!("No service `{}` found in DI container", T::service_name())))
.clone()
.downcast()
.unwrap()
}K
A
DZ
A
DZ
DZ