Struct xplane::XPAPI

source ·
pub struct XPAPI {
    pub avionics: AvionicsApi,
    pub camera: CameraApi,
    pub command: CommandApi,
    pub data: DataApi,
    pub features: FeatureApi,
    pub menu: MenuApi,
    pub nav: NavApi,
    pub paths: PathApi,
    pub player: PlayerApi,
    pub plugins: PluginApi,
    pub scenery: SceneryApi,
    pub weather: WeatherApi,
    /* private fields */
}
Expand description

Access struct for all APIs in this crate. Intentionally neither Send nor Sync. Almost nothing in this crate is.

Fields§

§avionics: AvionicsApi§camera: CameraApi§command: CommandApi§data: DataApi§features: FeatureApi§menu: MenuApi§nav: NavApi§paths: PathApi§player: PlayerApi§plugins: PluginApi§scenery: SceneryApi§weather: WeatherApi

Implementations§

source§

impl XPAPI

source

pub fn debug_string<S: Into<Vec<u8>>>(&mut self, s: S) -> Result<(), NulError>

Write a string to the X-Plane log. You probably want debug! or debugln! instead. Keep output to the X-Plane log to a minimum. This file can get rather cluttered.

§Errors

This function will error if the passed String has a NUL (‘\0’) character in it.

source

pub fn speak_string<S: Into<Vec<u8>>>(&mut self, s: S) -> Result<(), NulError>

Display a string on the screen, and speak it with TTS, if enabled.

§Errors

Returns a NulError if the passed string contains a NUL byte.

source

pub fn new_flight_loop<T: 'static>( &mut self, phase: FlightLoopPhase, callback: impl FlightLoopCallback<T>, base_state: T ) -> FlightLoop<T>

Creates a new flight loop. The provided callback will not be called until the loop is scheduled.

source

pub fn find_symbol<S: Into<String>>(&mut self, name: S) -> *mut c_void

Attempts to locate a symbol. If it exists, returns a pointer to it. Otherwise, a null pointer is returned.

source

pub fn get_versions(&mut self) -> ((i32, i32), i32)

Get the versions of X-Plane and XPLM, respectively.

There are no guarantees about the form of the version numbers, except that subsequent versions will have greater numbers.

The first entry of the tuple is a tuple containing:

  • The major version of X-Plane (the two most significant digits of the X-Plane version)
  • All remaining digits of the X-Plane version The second entry of the tuple is the XPLM version.
source

pub fn get_vkey_desc(&mut self, key: Key) -> &str

Get the description of a virtual key.

§Panics

Panics if X-Plane gives invalid UTF-8. If this happens, panicking here is the least of your problems.

source

pub fn get_language(&mut self) -> Option<&'static str>

Get the language X-Plane is running in. If recognized, returns Some, with the ISO 639-1 code. Returns None if it is not recognized.

Auto Trait Implementations§

§

impl RefUnwindSafe for XPAPI

§

impl !Send for XPAPI

§

impl !Sync for XPAPI

§

impl Unpin for XPAPI

§

impl UnwindSafe for XPAPI

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

§

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

§

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.