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

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.