Struct ServiceManager

Source
pub struct ServiceManager<'a> { /* private fields */ }

Implementations§

Source§

impl<'a> ServiceManager<'a>

Source

pub fn new() -> Self

Examples found in repository?
examples/myservice.rs (line 45)
44fn main() {
45    let mut service_manager = &mut ServiceManager::new();
46
47    let myservice = MyService {};
48
49    let mut service = service_manager.register_service(&myservice, "myservice", "com.example.IMyService", true, 0);
50
51
52    service.run();
53}
More examples
Hide additional examples
examples/simple.rs (line 5)
4fn main() {
5    let mut service_manager = &mut ServiceManager::new();
6
7    let mut package_manager = service_manager.get_service("myservice", "com.example.IMyService");
8
9    let mut parcel = Parcel::empty();
10    parcel.write_str16("Hello World");
11    let mut res = package_manager.call(1, &mut parcel);
12    println!("response: {:?}", res.read_str16());
13
14    let mut parcel = Parcel::empty();
15    parcel.write_str16("/data/local/tmp/testfile");
16    let mut res = package_manager.call(2, &mut parcel);
17    let fd = res.read_file_descriptor();
18    unsafe {
19        nix::libc::write(fd, "Hello world".as_ptr() as *const std::ffi::c_void, 11);
20    }
21}
Source

pub fn get_service( &'a mut self, service_name: &'a str, interface_name: &'a str, ) -> Service<'a>

Examples found in repository?
examples/simple.rs (line 7)
4fn main() {
5    let mut service_manager = &mut ServiceManager::new();
6
7    let mut package_manager = service_manager.get_service("myservice", "com.example.IMyService");
8
9    let mut parcel = Parcel::empty();
10    parcel.write_str16("Hello World");
11    let mut res = package_manager.call(1, &mut parcel);
12    println!("response: {:?}", res.read_str16());
13
14    let mut parcel = Parcel::empty();
15    parcel.write_str16("/data/local/tmp/testfile");
16    let mut res = package_manager.call(2, &mut parcel);
17    let fd = res.read_file_descriptor();
18    unsafe {
19        nix::libc::write(fd, "Hello world".as_ptr() as *const std::ffi::c_void, 11);
20    }
21}
Source

pub fn register_service<BS: BinderService>( &'a mut self, service_delegate: &'a BS, name: &'a str, interface_name: &'a str, allow_isolated: bool, dump_priority: u32, ) -> ServiceListener<'a, BS>

Examples found in repository?
examples/myservice.rs (line 49)
44fn main() {
45    let mut service_manager = &mut ServiceManager::new();
46
47    let myservice = MyService {};
48
49    let mut service = service_manager.register_service(&myservice, "myservice", "com.example.IMyService", true, 0);
50
51
52    service.run();
53}

Auto Trait Implementations§

§

impl<'a> Freeze for ServiceManager<'a>

§

impl<'a> RefUnwindSafe for ServiceManager<'a>

§

impl<'a> !Send for ServiceManager<'a>

§

impl<'a> !Sync for ServiceManager<'a>

§

impl<'a> Unpin for ServiceManager<'a>

§

impl<'a> UnwindSafe for ServiceManager<'a>

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.