use
{
crate :: { TokioTp } ,
std :: { sync::Arc } ,
tokio::runtime :: { Builder } ,
};
#[ derive(Debug) ]
pub struct TokioTpBuilder
{
builder: Builder,
}
impl TokioTpBuilder
{
pub fn new() -> Self
{
Self
{
builder: Builder::new_multi_thread(),
}
}
pub fn tokio_builder( &mut self ) -> &mut Builder
{
&mut self.builder
}
pub fn build( &mut self ) -> Result<TokioTp, std::io::Error>
{
let exec = self.builder.build()?;
Ok( TokioTp
{
exec: Some( Arc::new(exec) ),
})
}
}
impl Default for TokioTpBuilder
{
fn default() -> Self
{
Self::new()
}
}