Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5b533d28 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "libbinder_rs: Fix broken documentation links" into main

parents b9ca9119 3e9c13a2
Loading
Loading
Loading
Loading
+5 −5
Original line number Original line Diff line number Diff line
@@ -97,8 +97,8 @@ where


/// Interface stability promise
/// Interface stability promise
///
///
/// An interface can promise to be a stable vendor interface ([`Vintf`]), or
/// An interface can promise to be a stable vendor interface ([`Stability::Vintf`]),
/// makes no stability guarantees ([`Local`]). [`Local`] is
/// or makes no stability guarantees ([`Stability::Local`]). [`Stability::Local`] is
/// currently the default stability.
/// currently the default stability.
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Default)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Default)]
pub enum Stability {
pub enum Stability {
@@ -139,8 +139,8 @@ impl TryFrom<i32> for Stability {
/// via `Binder::new(object)`.
/// via `Binder::new(object)`.
///
///
/// This is a low-level interface that should normally be automatically
/// This is a low-level interface that should normally be automatically
/// generated from AIDL via the [`declare_binder_interface!`] macro. When using
/// generated from AIDL via the [`crate::declare_binder_interface!`] macro.
/// the AIDL backend, users need only implement the high-level AIDL-defined
/// When using the AIDL backend, users need only implement the high-level AIDL-defined
/// interface. The AIDL compiler then generates a container struct that wraps
/// interface. The AIDL compiler then generates a container struct that wraps
/// the user-defined service and implements `Remotable`.
/// the user-defined service and implements `Remotable`.
pub trait Remotable: Send + Sync {
pub trait Remotable: Send + Sync {
@@ -297,7 +297,7 @@ impl InterfaceClass {
    /// Note: the returned pointer will not be constant. Calling this method
    /// Note: the returned pointer will not be constant. Calling this method
    /// multiple times for the same type will result in distinct class
    /// multiple times for the same type will result in distinct class
    /// pointers. A static getter for this value is implemented in
    /// pointers. A static getter for this value is implemented in
    /// [`declare_binder_interface!`].
    /// [`crate::declare_binder_interface!`].
    pub fn new<I: InterfaceClassMethods>() -> InterfaceClass {
    pub fn new<I: InterfaceClassMethods>() -> InterfaceClass {
        let descriptor = CString::new(I::get_descriptor()).unwrap();
        let descriptor = CString::new(I::get_descriptor()).unwrap();
        let ptr = unsafe {
        let ptr = unsafe {
+2 −2
Original line number Original line Diff line number Diff line
@@ -461,7 +461,7 @@ impl<'a> BorrowedParcel<'a> {
    /// and call a closure with the sub-parcel as its parameter.
    /// and call a closure with the sub-parcel as its parameter.
    /// The closure can keep reading data from the sub-parcel
    /// The closure can keep reading data from the sub-parcel
    /// until it runs out of input data. The closure is responsible
    /// until it runs out of input data. The closure is responsible
    /// for calling [`ReadableSubParcel::has_more_data`] to check for
    /// for calling `ReadableSubParcel::has_more_data` to check for
    /// more data before every read, at least until Rust generators
    /// more data before every read, at least until Rust generators
    /// are stabilized.
    /// are stabilized.
    /// After the closure returns, skip to the end of the current
    /// After the closure returns, skip to the end of the current
@@ -595,7 +595,7 @@ impl Parcel {
    /// and call a closure with the sub-parcel as its parameter.
    /// and call a closure with the sub-parcel as its parameter.
    /// The closure can keep reading data from the sub-parcel
    /// The closure can keep reading data from the sub-parcel
    /// until it runs out of input data. The closure is responsible
    /// until it runs out of input data. The closure is responsible
    /// for calling [`ReadableSubParcel::has_more_data`] to check for
    /// for calling `ReadableSubParcel::has_more_data` to check for
    /// more data before every read, at least until Rust generators
    /// more data before every read, at least until Rust generators
    /// are stabilized.
    /// are stabilized.
    /// After the closure returns, skip to the end of the current
    /// After the closure returns, skip to the end of the current
+5 −6
Original line number Original line Diff line number Diff line
@@ -50,14 +50,14 @@ pub trait Parcelable {
    fn read_from_parcel(&mut self, parcel: &BorrowedParcel<'_>) -> Result<()>;
    fn read_from_parcel(&mut self, parcel: &BorrowedParcel<'_>) -> Result<()>;
}
}


/// A struct whose instances can be written to a [`Parcel`].
/// A struct whose instances can be written to a [`crate::parcel::Parcel`].
// Might be able to hook this up as a serde backend in the future?
// Might be able to hook this up as a serde backend in the future?
pub trait Serialize {
pub trait Serialize {
    /// Serialize this instance into the given [`Parcel`].
    /// Serialize this instance into the given [`crate::parcel::Parcel`].
    fn serialize(&self, parcel: &mut BorrowedParcel<'_>) -> Result<()>;
    fn serialize(&self, parcel: &mut BorrowedParcel<'_>) -> Result<()>;
}
}


/// A struct whose instances can be restored from a [`Parcel`].
/// A struct whose instances can be restored from a [`crate::parcel::Parcel`].
// Might be able to hook this up as a serde backend in the future?
// Might be able to hook this up as a serde backend in the future?
pub trait Deserialize: Sized {
pub trait Deserialize: Sized {
    /// Type for the uninitialized value of this type. Will be either `Self`
    /// Type for the uninitialized value of this type. Will be either `Self`
@@ -80,10 +80,10 @@ pub trait Deserialize: Sized {
    /// Convert an initialized value of type `Self` into `Self::UninitType`.
    /// Convert an initialized value of type `Self` into `Self::UninitType`.
    fn from_init(value: Self) -> Self::UninitType;
    fn from_init(value: Self) -> Self::UninitType;


    /// Deserialize an instance from the given [`Parcel`].
    /// Deserialize an instance from the given [`crate::parcel::Parcel`].
    fn deserialize(parcel: &BorrowedParcel<'_>) -> Result<Self>;
    fn deserialize(parcel: &BorrowedParcel<'_>) -> Result<Self>;


    /// Deserialize an instance from the given [`Parcel`] onto the
    /// Deserialize an instance from the given [`crate::parcel::Parcel`] onto the
    /// current object. This operation will overwrite the old value
    /// current object. This operation will overwrite the old value
    /// partially or completely, depending on how much data is available.
    /// partially or completely, depending on how much data is available.
    fn deserialize_from(&mut self, parcel: &BorrowedParcel<'_>) -> Result<()> {
    fn deserialize_from(&mut self, parcel: &BorrowedParcel<'_>) -> Result<()> {
@@ -880,7 +880,6 @@ impl<T: DeserializeOption> Deserialize for Option<T> {
/// `Serialize`, `SerializeArray` and `SerializeOption` for
/// `Serialize`, `SerializeArray` and `SerializeOption` for
/// structured parcelables. The target type must implement the
/// structured parcelables. The target type must implement the
/// `Parcelable` trait.
/// `Parcelable` trait.
/// ```
#[macro_export]
#[macro_export]
macro_rules! impl_serialize_for_parcelable {
macro_rules! impl_serialize_for_parcelable {
    ($parcelable:ident) => {
    ($parcelable:ident) => {
+4 −4
Original line number Original line Diff line number Diff line
@@ -574,7 +574,7 @@ impl Drop for WpIBinder {


/// Rust wrapper around DeathRecipient objects.
/// Rust wrapper around DeathRecipient objects.
///
///
/// The cookie in this struct represents an Arc<F> for the owned callback.
/// The cookie in this struct represents an `Arc<F>` for the owned callback.
/// This struct owns a ref-count of it, and so does every binder that we
/// This struct owns a ref-count of it, and so does every binder that we
/// have been linked with.
/// have been linked with.
///
///
@@ -667,7 +667,7 @@ impl DeathRecipient {
    ///
    ///
    /// # Safety
    /// # Safety
    ///
    ///
    /// The `cookie` parameter must be the cookie for an Arc<F> and
    /// The `cookie` parameter must be the cookie for an `Arc<F>` and
    /// the caller must hold a ref-count to it.
    /// the caller must hold a ref-count to it.
    unsafe extern "C" fn binder_died<F>(cookie: *mut c_void)
    unsafe extern "C" fn binder_died<F>(cookie: *mut c_void)
    where
    where
@@ -682,7 +682,7 @@ impl DeathRecipient {
    ///
    ///
    /// # Safety
    /// # Safety
    ///
    ///
    /// The `cookie` parameter must be the cookie for an Arc<F> and
    /// The `cookie` parameter must be the cookie for an `Arc<F>` and
    /// the owner must give up a ref-count to it.
    /// the owner must give up a ref-count to it.
    unsafe extern "C" fn cookie_decr_refcount<F>(cookie: *mut c_void)
    unsafe extern "C" fn cookie_decr_refcount<F>(cookie: *mut c_void)
    where
    where
@@ -695,7 +695,7 @@ impl DeathRecipient {
    ///
    ///
    /// # Safety
    /// # Safety
    ///
    ///
    /// The `cookie` parameter must be the cookie for an Arc<F> and
    /// The `cookie` parameter must be the cookie for an `Arc<F>` and
    /// the owner must handle the created ref-count properly.
    /// the owner must handle the created ref-count properly.
    unsafe extern "C" fn cookie_incr_refcount<F>(cookie: *mut c_void)
    unsafe extern "C" fn cookie_incr_refcount<F>(cookie: *mut c_void)
    where
    where