Skip to content

Commit

Permalink
fix for new Tesseract.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
ypopovych committed Nov 23, 2023
1 parent 00529aa commit c88da4a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Rust/tesseract/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,25 +66,25 @@ pub struct ClientTesseract(SyncPtr<Void>);

impl Drop for ClientTesseract {
fn drop(&mut self) {
let _ = unsafe { self.0.take_typed::<Tesseract<ClientTesseractDelegate>>() };
let _ = unsafe { self.0.take_typed::<Tesseract>() };
}
}

impl ClientTesseract {
pub fn new(tesseract: Tesseract<ClientTesseractDelegate>) -> Self {
pub fn new(tesseract: Tesseract) -> Self {
Self(SyncPtr::new(tesseract).as_void())
}

pub fn service<P: Protocol + Copy + 'static>(&self, r#for: P) -> Arc<impl Service<Protocol = P>> {
let tesseract = unsafe {
self.0.as_typed_ref::<Tesseract<ClientTesseractDelegate>>()
self.0.as_typed_ref::<Tesseract>()
};
tesseract.unwrap().service(r#for)
}

pub fn transport<T: Transport + 'static + Sync + Send>(&mut self, transport: T) -> Self {
let tesseract = unsafe {
self.0.take_typed::<Tesseract<ClientTesseractDelegate>>()
self.0.take_typed::<Tesseract>()
};
Self::new(tesseract.transport(transport))
}
Expand Down

0 comments on commit c88da4a

Please sign in to comment.