matrix-sdk: Implement deref for our device wrapper.
parent
fd8377bce2
commit
94248523b3
|
@ -1450,7 +1450,7 @@ impl Client {
|
|||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```
|
||||
/// ```no_run
|
||||
/// # use std::convert::TryFrom;
|
||||
/// # use matrix_sdk::{Client, identifiers::UserId};
|
||||
/// # use url::Url;
|
||||
|
@ -1459,9 +1459,12 @@ impl Client {
|
|||
/// # let homeserver = Url::parse("http://example.com").unwrap();
|
||||
/// # let client = Client::new(homeserver).unwrap();
|
||||
/// # block_on(async {
|
||||
/// let device = client.get_device(&alice, "DEVICEID".into()).await;
|
||||
/// let device = client.get_device(&alice, "DEVICEID".into()).await.unwrap();
|
||||
///
|
||||
/// println!("{:?}", device);
|
||||
/// println!("{:?}", device.is_trusted());
|
||||
///
|
||||
///
|
||||
/// let verification = device.start_verification().await.unwrap();
|
||||
/// # });
|
||||
/// ```
|
||||
#[cfg(feature = "encryption")]
|
||||
|
|
|
@ -12,7 +12,9 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use matrix_sdk_base::{DeviceWrap, UserDevicesWrap};
|
||||
use std::ops::Deref;
|
||||
|
||||
use matrix_sdk_base::{Device as ReadOnlyDevice, DeviceWrap, UserDevicesWrap};
|
||||
use matrix_sdk_common::{
|
||||
api::r0::to_device::send_event_to_device::Request as ToDeviceRequest, identifiers::DeviceId,
|
||||
};
|
||||
|
@ -26,6 +28,14 @@ pub struct Device {
|
|||
pub(crate) http_client: HttpClient,
|
||||
}
|
||||
|
||||
impl Deref for Device {
|
||||
type Target = ReadOnlyDevice;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self.inner
|
||||
}
|
||||
}
|
||||
|
||||
impl Device {
|
||||
/// Start a interactive verification with this `Device`
|
||||
///
|
||||
|
|
Loading…
Reference in New Issue