Skip to content

Commit

Permalink
Generate device returns DeviceAddResult again
Browse files Browse the repository at this point in the history
  • Loading branch information
giarc3 committed Oct 24, 2024
1 parent b8ece70 commit ca762f2
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions src/blocking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@ pub struct BlockingDeviceContext {
pub(crate) rt: Arc<Runtime>,
}

impl From<DeviceAddResult> for BlockingDeviceContext {
fn from(value: DeviceAddResult) -> Self {
Self {
device: value.into(),
rt: Arc::new(create_runtime()),
}
}
}

impl BlockingDeviceContext {
pub fn new(device: DeviceContext) -> Self {
Self {
Expand Down Expand Up @@ -273,20 +282,14 @@ impl BlockingIronOxide {
password: &str,
device_create_options: &DeviceCreateOpts,
timeout: Option<std::time::Duration>,
) -> Result<BlockingDeviceContext> {
) -> Result<DeviceAddResult> {
let rt = create_runtime();
let device: DeviceContext = rt
.block_on(IronOxide::generate_new_device(
jwt,
password,
device_create_options,
timeout,
))?
.into();
Ok(BlockingDeviceContext {
device,
rt: Arc::new(rt),
})
rt.block_on(IronOxide::generate_new_device(
jwt,
password,
device_create_options,
timeout,
))
}
/// See [ironoxide::user::UserOps::user_delete_device](trait.UserOps.html#tymethod.user_delete_device)
pub fn user_delete_device(&self, device_id: Option<&DeviceId>) -> Result<DeviceId> {
Expand Down

0 comments on commit ca762f2

Please sign in to comment.