Skip to main content

Network

Struct Network 

Source
pub struct Network {
    pub name: String,
    pub rank: i32,
    pub frequency_unit: String,
    pub parameter: String,
    pub format: String,
    pub resistance_string: String,
    pub z0: f64,
    pub comments: Vec<String>,
    pub comments_after_option_line: Vec<String>,
    pub f: Vec<f64>,
    pub s: Vec<ParsedDataLine>,
}

Fields§

§name: String§rank: i32§frequency_unit: String§parameter: String§format: String§resistance_string: String§z0: f64§comments: Vec<String>§comments_after_option_line: Vec<String>§f: Vec<f64>§s: Vec<ParsedDataLine>

Implementations§

Source§

impl Network

Source

pub fn new(file_path: String) -> Self

Source

pub fn print_summary(&self)

Source

pub fn f(&self) -> Vec<f64>

Source

pub fn s_db(&self, j: i8, k: i8) -> Vec<FrequencyDB>

Source

pub fn s_ri(&self, j: i8, k: i8) -> Vec<FrequencyRI>

Source

pub fn s_ma(&self, j: i8, k: i8) -> Vec<FrequencyMA>

Source

pub fn cascade(&self, other: &Network) -> Network

Cascade two 2-port networks (standard connection: port 2 → port 1)

For more control over port connections, use cascade_ports().

Source

pub fn cascade_ports( &self, other: &Network, from_port: usize, to_port: usize, ) -> Network

Cascade two networks with explicit port specification

§Arguments
  • other - The network to cascade with
  • from_port - Output port of self to connect (1-indexed)
  • to_port - Input port of other to connect (1-indexed)
§Examples
use touchstone::Network;

let net1 = Network::new("files/ntwk1.s2p".to_string());
let net2 = Network::new("files/ntwk2.s2p".to_string());

// Standard 2-port cascade (port 2 → port 1)
let result = net1.cascade_ports(&net2, 2, 1);
§Current Limitations
  • Only 2-port networks with standard connection (2→1) are currently supported
  • N-port cascade (N > 2) will be implemented in a future release
§Panics
  • If port numbers are out of range
  • If networks are not 2-port
  • If connection is not standard (2→1) for 2-port networks
Source

pub fn save(&self, file_path: &str) -> Result<()>

Trait Implementations§

Source§

impl Clone for Network

Source§

fn clone(&self) -> Network

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Network

Source§

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

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

impl Mul for Network

Source§

type Output = Network

The resulting type after applying the * operator.
Source§

fn mul(self, _rhs: Network) -> Network

Performs the * operation. 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> 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, 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> 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 = 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.