Skip to main content

EndfRetriever

Struct EndfRetriever 

Source
pub struct EndfRetriever { /* private fields */ }
Expand description

ENDF file retrieval manager with local caching.

Implementations§

Source§

impl EndfRetriever

Source

pub fn new() -> Self

Create a new retriever with default cache location (~/.cache/nereids/endf/).

Source

pub fn with_cache_dir(cache_dir: impl Into<PathBuf>) -> Self

Create a retriever with a custom cache directory.

Source

pub fn cache_dir(&self, library: EndfLibrary) -> PathBuf

Get the cache directory for a specific library.

Public so the GUI can show users exactly where to drop a manually- downloaded ENDF file when a fetch fails (issue #523).

Source

pub fn cache_file_path( &self, isotope: &Isotope, library: EndfLibrary, ) -> PathBuf

Get the cached ENDF file path for an isotope.

Public so callers can present the exact target path for manual file drops; see Self::install_local_endf for the programmatic equivalent.

Source

pub fn get_endf_file( &self, isotope: &Isotope, library: EndfLibrary, mat: u32, ) -> Result<(PathBuf, String), EndfRetrievalError>

Retrieve the ENDF file for an isotope, using cache if available.

Returns the path to the cached ENDF file and its contents as a string.

§Arguments
  • isotope — The isotope to retrieve data for.
  • library — The ENDF library to use.
  • mat — The ENDF MAT (material) number.
Source

pub fn peek_local_endf( source: &Path, ) -> Result<(Isotope, String), EndfRetrievalError>

Peek a user-supplied ENDF source: decode the body and parse the HEAD record so the caller can route the upload to the correct isotope entry.

Accepts the same input forms as Self::install_local_endf — a raw ENDF text file or the IAEA ZIP archive distribution — and returns the isotope declared by the file’s MF=2 MT=151 HEAD record alongside the decoded text. The GUI uses this to dispatch a manual upload to the matching IsotopeEntry without re-reading or re-extracting the file during install (issue #523, P2: avoid N-pass zip extraction).

Source

pub fn install_endf_text( &self, isotope: &Isotope, library: EndfLibrary, text: &str, ) -> Result<PathBuf, EndfRetrievalError>

Write already-validated ENDF text to the canonical cache slot for isotope/library. Returns the cache file path.

Use this when the caller has already obtained text via Self::peek_local_endf and confirmed the isotope. For one-shot install-from-path, use Self::install_local_endf instead.

Source

pub fn install_local_endf( &self, isotope: &Isotope, library: EndfLibrary, source: &Path, ) -> Result<(PathBuf, String), EndfRetrievalError>

Install a user-supplied ENDF file into the cache for isotope/library.

Accepts either a raw ENDF text file (.endf, .dat, .txt, or extensionless) or the IAEA ZIP archive distribution (n_…_….zip). The file is parsed to verify that its declared isotope matches isotope; on success the text is written to the canonical cache slot returned by Self::cache_file_path and (cache_path, text) is returned. Subsequent calls to Self::get_endf_file will then hit the cache without any network access.

This is the GUI’s manual-upload escape hatch for users on networks where IAEA/NNDC is blocked (issue #523).

Trait Implementations§

Source§

impl Default for EndfRetriever

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

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

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

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.

§

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

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: 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
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: 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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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