pub trait IndexesExt {
// Required method
fn retain_actual_by_till(&mut self);
// Provided method
fn into_actual_by_till(self) -> Self
where Self: Sized { ... }
}Expand description
Fluent-операции над коллекцией индексов.
Required Methods§
Sourcefn retain_actual_by_till(&mut self)
fn retain_actual_by_till(&mut self)
Оставить только индексы с максимальным till.
Provided Methods§
Sourcefn into_actual_by_till(self) -> Selfwhere
Self: Sized,
fn into_actual_by_till(self) -> Selfwhere
Self: Sized,
Вернуть коллекцию индексов только с максимальным till.
Examples found in repository?
examples/actual_indexes_dump.rs (line 68)
67fn load_actual_index_dumps(moex_client: &Client) -> Result<Vec<IndexDump>, ExampleError> {
68 let indexes = with_retry(retry_policy(), || moex_client.indexes())?.into_actual_by_till();
69 let page_limit = NonZeroU32::new(INDEX_ANALYTICS_PAGE_LIMIT)
70 .expect("INDEX_ANALYTICS_PAGE_LIMIT constant must be greater than zero");
71
72 indexes
73 .into_iter()
74 .map(|index| {
75 let components = with_retry(retry_policy(), || {
76 moex_client
77 .index(index.id().clone())
78 .expect("index id from payload must be valid")
79 .analytics_pages(page_limit)
80 .all()
81 })?
82 .into_actual_by_session()
83 .into_sorted_by_weight_desc();
84 Ok(IndexDump {
85 index_id: index.id().as_str().to_owned().into_boxed_str(),
86 short_name: index.short_name().to_owned().into_boxed_str(),
87 components,
88 })
89 })
90 .collect()
91}