typeshare icon indicating copy to clipboard operation
typeshare copied to clipboard

Arc & Mutex (and RwLock, RC, RefCell)

Open HHogg opened this issue 1 year ago • 1 comments

#[derive(Serialize)]
#[typeshare]
struct MyStruct {
  arc_mutex: Arc<Mutex<SomeOtherStruct>>,
  box: Box<SomeOtherStruct>
}

The above currently outputs (in typescript)

export interface MyStruct {
  arc_mutex: Arc<Mutex<SomeOtherStruct>>,
  box: SomeOtherStruct,
}

Similar to how Box is handled, should typeshare omit Arc and Mutex from the output? (serde automatically handles this too).


I'm working around this like...

#![allow(unused)]

use typeshare::typeshare;

#[typeshare]
type Arc<T> = T;

#[typeshare]
type Mutex<T> = T;

#[typeshare]
type RwLock<T> = T;

HHogg avatar Jul 17 '23 23:07 HHogg

I've just seen #134 nice!

HHogg avatar Jul 18 '23 07:07 HHogg