Skip to main content

select_geo_bans

Function select_geo_bans 

Source
pub fn select_geo_bans(
    value: &RecordValue,
    selector: &GeoBanSelector,
) -> Result<Vec<GeoBan>>
Expand description

Picks bans of value without changing anything. Each ban is returned once, even if its area is given more than once.

§Errors

  • Error::InvalidInput if value was read without its geo bans.
  • Error::NotFound if an area is not banned or no ban has the uuid. Nothing is returned then, so a typo cannot lead to removing only part of the selection.

§Examples

use dinio_sdk::models::{GeoCatalog, RecordValue};
use dinio_sdk::ops::{self, GeoBanSelector};

let selector = GeoBanSelector::Areas(vec![catalog.parse_area("HR")?]);
for ban in ops::select_geo_bans(value, &selector)? {
    println!("would remove {}", ban.describe(catalog));
}