Skip to main content

InterfaceCallbacks

Struct InterfaceCallbacks 

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

Opaque callback adapter owned by the native chip instance.

Implementations§

Source§

impl InterfaceCallbacks

Source

pub fn new(handler: InterfaceHandler) -> Self

Create a callback adapter containing the supplied host handlers.

Examples found in repository?
examples/vgmrender.rs (lines 50-52)
42    fn new(chip_type: ChipType, clock: u32) -> Self {
43        let state = Rc::new(RefCell::new(VgmHandlerState {
44            data: std::array::from_fn(|_| Vec::new()),
45        }));
46        let pcm_offset = Rc::new(RefCell::new(0u32));
47        let chip = ffi::create_chip_with_callbacks(
48            chip_type,
49            clock,
50            Box::new(InterfaceCallbacks::new(vgm_handler_with_state(Rc::clone(
51                &state,
52            )))),
53        );
54        let channels = chip.channels() as usize;
55        let step: EmulatedTime = 0x1_0000_0000i64 / i64::from(chip.sample_rate());
56        Self {
57            chip,
58            channels,
59            queue: std::collections::VecDeque::new(),
60            pos: 0,
61            step,
62            native: vec![0i32; channels],
63            handler_state: state,
64            pcm_offset,
65        }
66    }

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.

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