pub enum Query {
AllWithinField,
NearestOne,
NearestN {
n: usize,
max_radius: Option<Angle>,
},
}Expand description
What to return from a match.
Set on a Constraint via Constraint::all, Constraint::nearest_one,
Constraint::nearest_n, or Constraint::nearest_n_within.
§Example
use skymath::{Angle, Equatorial, ParseMode};
use target_match::{rank, Constraint, SkyObject};
struct Target {
ra: f64,
dec: f64,
}
impl SkyObject for Target {
fn position(&self) -> Equatorial {
Equatorial::j2000(Angle::from_degrees(self.ra), Angle::from_degrees(self.dec)).unwrap()
}
}
let catalog = [Target { ra: 10.6847, dec: 41.2688 }];
let pointing = Equatorial::parse_j2000("00:42:44.3", "+41:16:09", ParseMode::Strict).unwrap();
// `nearest_n(1)` sets the query to `Query::NearestN { n: 1, .. }`.
let hits = rank(pointing, &catalog, Constraint::circular(Angle::from_degrees(1.0)).nearest_n(1));
assert_eq!(hits.len(), 1);Variants§
AllWithinField
Every object inside the membership shape, ranked nearest-first.
NearestOne
The single nearest in-frame object.
NearestN
The n nearest objects by separation, optionally bounded by a radius.
Trait Implementations§
impl Copy for Query
Source§impl<'de> Deserialize<'de> for Query
impl<'de> Deserialize<'de> for Query
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Query
Auto Trait Implementations§
impl Freeze for Query
impl RefUnwindSafe for Query
impl Send for Query
impl Sync for Query
impl Unpin for Query
impl UnsafeUnpin for Query
impl UnwindSafe for Query
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more