pub struct NativeBackend {
browser: Arc<RwLock<Browser>>,
harness_url: String,
semaphore: Arc<Semaphore>,
_harness_file: NamedTempFile,
context_ttl_requests: usize,
request_count: AtomicUsize,
restarting: AtomicBool,
}Expand description
Native browser backend using the headless_chrome crate.
Fields§
§browser: Arc<RwLock<Browser>>§harness_url: String§semaphore: Arc<Semaphore>§_harness_file: NamedTempFile§context_ttl_requests: usize§request_count: AtomicUsize§restarting: AtomicBoolImplementations§
Source§impl NativeBackend
impl NativeBackend
pub async fn new( pool_size: usize, context_ttl_requests: usize, ) -> Result<Self, String>
fn build_harness() -> Result<(String, NamedTempFile), String>
fn default_launch_options() -> LaunchOptions<'static>
async fn spawn_browser() -> Result<Browser, String>
async fn restart_browser(&self) -> Result<(), String>
fn should_restart(&self) -> bool
async fn maybe_restart(&self)
async fn acquire_browser(&self) -> Browser
async fn do_render( &self, tab: &Tab, diagram_type: &str, source: &str, _format: &str, ) -> DiagramResult<Vec<u8>>
Trait Implementations§
Source§impl BrowserBackend for NativeBackend
impl BrowserBackend for NativeBackend
Source§fn render<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
diagram_type: &'life1 str,
source: &'life2 str,
format: &'life3 str,
) -> Pin<Box<dyn Future<Output = DiagramResult<Vec<u8>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn render<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
diagram_type: &'life1 str,
source: &'life2 str,
format: &'life3 str,
) -> Pin<Box<dyn Future<Output = DiagramResult<Vec<u8>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Renders a diagram using the browser.
Auto Trait Implementations§
impl !Freeze for NativeBackend
impl !RefUnwindSafe for NativeBackend
impl Send for NativeBackend
impl Sync for NativeBackend
impl Unpin for NativeBackend
impl !UnwindSafe for NativeBackend
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more