JackPort

Struct JackPort 

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

An object used for moving data of any type in or out of the client.

Ports may be connected in various ways.

Each port has a short name. The port’s full name contains the name of the client concatenated with a colon (:) followed by its short name. The jack_port_name_size() is the maximum length of this full name. Exceeding that will cause port registration to fail and return ProgrammerError.

Implementations§

Source§

impl JackPort

Source

pub fn as_ptr(&self) -> JackPortPtr

Source

pub unsafe fn from_ptr(ptr: JackPortPtr) -> Self

Source

pub fn set_short_name(&mut self, name: &str) -> JackResult<()>

Modify a port’s short name. May be called at any time.

If the resulting full name (including the “client_name:” prefix) is longer than jack_port_name_size(), it will be truncated.

Source

pub fn get_name(&self, short: bool) -> JackResult<Cow<'_, str>>

Get the name of a port (short or long, determined by the short argument).

Examples found in repository?
examples/simple_client.rs (line 35)
19fn run() -> JackResult<()> {
20    let mut conn = JackConnection::connect("simple_client", None)?;
21    let inp = conn.register_port("input", PORT_IS_INPUT)?;
22    let out = conn.register_port("output", PORT_IS_OUTPUT)?;
23    let ports = Ports {
24        inp: inp,
25        out: out
26    };
27    conn.set_handler(ports)?;
28    let mut conn = match conn.activate() {
29        Ok(nc) => nc,
30        Err((_, err)) => return Err(err)
31    };
32    let ports = conn.get_ports(None, None, Some(PORT_IS_INPUT | PORT_IS_PHYSICAL))?;
33    if ports.len() >= 1 {
34        conn.connect_ports(&out, &ports[0])?;
35        println!("Connected output port to {}", ports[0].get_name(false)?);
36    }
37    let ports = conn.get_ports(None, None, Some(PORT_IS_OUTPUT | PORT_IS_PHYSICAL))?;
38    if ports.len() >= 1 {
39        conn.connect_ports(&ports[0], &inp)?;
40        println!("Connected input port to {}", ports[0].get_name(false)?);
41    }
42    thread::sleep(::std::time::Duration::new(60 * 60, 0));
43    Ok(())
44}
Source

pub fn get_type(&self) -> JackResult<Cow<'_, str>>

Get the type string of a port.

Source

pub unsafe fn get_name_raw(&self, short: bool) -> JackResult<*const c_char>

Get the raw pointer to the name of a port.

§Safety

This function is not intended for external consumption.

Source

pub fn get_flags(&self) -> JackPortFlags

Get the JackPortFlags of the port.

Trait Implementations§

Source§

impl Clone for JackPort

Source§

fn clone(&self) -> JackPort

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 JackPort

Source§

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

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

impl Copy for JackPort

Source§

impl Send for JackPort

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.