Skip to main content

CachedTarget

Struct CachedTarget 

Source
pub struct CachedTarget {
    pub id: Uuid,
    pub simbad_oid: Option<i64>,
    pub primary_designation: String,
    pub common_name: Option<String>,
    pub object_type: ObjectType,
    pub otype_raw: String,
    pub ra_deg: f64,
    pub dec_deg: f64,
    pub v_mag: Option<f64>,
    pub source: TargetSource,
    pub resolved_at: String,
    pub aliases: Vec<ResolvedAlias>,
}
Expand description

A cached canonical target plus its aliases, as read back from a Cache.

Mirrors ResolvedIdentity but additionally carries the persisted CachedTarget::id and CachedTarget::resolved_at.

Fields§

§id: Uuid

Persisted target id (UUIDv5 derived from the caller namespace).

§simbad_oid: Option<i64>

SIMBAD physical-object id (dedup key) when resolved online.

§primary_designation: String

Canonical display designation.

§common_name: Option<String>

Curated common name when one exists.

§object_type: ObjectType

Closed object-type classification.

§otype_raw: String

Raw SIMBAD otype string (escape hatch alongside object_type).

§ra_deg: f64

ICRS J2000 right ascension, decimal degrees.

§dec_deg: f64

ICRS J2000 declination, decimal degrees.

§v_mag: Option<f64>

Johnson V-band apparent magnitude (SIMBAD allfluxes.V) when known.

§source: TargetSource

Provenance of the stored identity.

§resolved_at: String

RFC 3339 timestamp of the last seed/resolve/override.

§aliases: Vec<ResolvedAlias>

All aliases (designations + common names + user-added).

Implementations§

Source§

impl CachedTarget

Source

pub fn to_identity(&self) -> ResolvedIdentity

Build a ResolvedIdentity view of this cached target.

use simbad_resolver::{AliasKind, CachedTarget, ObjectType, ResolvedAlias, TargetSource};
use uuid::Uuid;

let target = CachedTarget {
    id: Uuid::nil(),
    simbad_oid: Some(1_575_544),
    primary_designation: "M 31".to_owned(),
    common_name: Some("Andromeda Galaxy".to_owned()),
    object_type: ObjectType::Galaxy,
    otype_raw: "G".to_owned(),
    ra_deg: 10.684_708,
    dec_deg: 41.268_75,
    v_mag: Some(3.44),
    source: TargetSource::Resolved,
    resolved_at: "2026-07-11T00:00:00Z".to_owned(),
    aliases: vec![ResolvedAlias::new("NGC 224", AliasKind::Designation)],
};
let identity = target.to_identity();
assert_eq!(identity.primary_designation, "M 31");
assert_eq!(identity.aliases, target.aliases);
Source

pub fn position(&self) -> Result<Equatorial>

This target’s sky position as a typed skymath::Equatorial coordinate.

SIMBAD coordinates are ICRS; at planning grade (≤ ~1 arcminute) ICRS is treated as J2000. The raw Self::ra_deg / Self::dec_deg fields remain the canonical storage.

§Errors

skymath::Error::OutOfRange if the stored values are outside RA [0, 360) / Dec [-90, +90] (malformed cache content).

use simbad_resolver::{AliasKind, CachedTarget, ObjectType, ResolvedAlias, TargetSource};
use uuid::Uuid;

let target = CachedTarget {
    id: Uuid::nil(), simbad_oid: Some(1_575_544), primary_designation: "M 31".to_owned(),
    common_name: None, object_type: ObjectType::Galaxy, otype_raw: "G".to_owned(),
    ra_deg: 10.684_708, dec_deg: 41.268_75, v_mag: Some(3.44),
    source: TargetSource::Resolved, resolved_at: "2026-07-11T00:00:00Z".to_owned(),
    aliases: vec![ResolvedAlias::new("M 31", AliasKind::Designation)],
};
let eq = target.position()?;
assert!((eq.ra().degrees() - 10.684_708).abs() < 1e-6);

Trait Implementations§

Source§

impl Clone for CachedTarget

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CachedTarget

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for CachedTarget

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for CachedTarget

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more