math_adapter/abs/
as_foreign.rs

1//!
2//! Interfaces to either conver or reinterpret nath data structure as analog of math lib of choice..
3//!
4
5/// Internal namespace.
6pub( crate ) mod private
7{
8  // use crate::prelude::*;
9
10  ///
11  /// Trait to interpret non-canonical math data structures of other math libs as their analogs a math lib of choice to use operations of the library..
12  ///
13
14  pub trait AsForeignNonCanonicalInterface< T >
15  where
16    T : Copy,
17    Self : Copy,
18  {
19    /// Clone this data structure as analog of a math lib of choice to use its operations.
20    fn clone_as_foreign( &self ) -> T;
21  }
22
23  ///
24  /// Trait to interpret canonical math data structures of other math libs as their analogs a math lib of choice to use operations of the library..
25  ///
26
27  pub trait AsForeignCanonicalInterface< T >
28  where
29    T : Copy,
30    Self : AsForeignNonCanonicalInterface< T > + Copy,
31  {
32    /// Interpret this data structure as analog of a math lib of choice to use its operations.
33    fn as_foreign( &self ) -> &T;
34    /// Interpret this data structure mutably as analog of a math lib of choice to use its operations.
35    fn as_foreign_mut( &mut self ) -> &mut T;
36  }
37
38}
39
40crate::mod_interface!
41{
42  prelude use AsForeignNonCanonicalInterface;
43  prelude use AsForeignCanonicalInterface;
44}