pub struct ReportsWebEngine { /* private fields */ }Expand description
Async client for the Reports.Web engine.
let engine = reports_web::ReportsWebEngine::new("http://127.0.0.1:3107")?;
let pdf: Vec<u8> = engine.render_pdf(&print_data).await?;Implementations§
Source§impl ReportsWebEngine
impl ReportsWebEngine
Sourcepub fn new(url: &str) -> Result<Self, EngineError>
pub fn new(url: &str) -> Result<Self, EngineError>
Client for url with a 90 second timeout.
Sourcepub fn from_env() -> Result<Self, EngineError>
pub fn from_env() -> Result<Self, EngineError>
Client for REPORTS_ENGINE_URL, or http://127.0.0.1:3107 when unset.
Sourcepub fn with_timeout(url: &str, timeout: Duration) -> Result<Self, EngineError>
pub fn with_timeout(url: &str, timeout: Duration) -> Result<Self, EngineError>
Client for url with the given request timeout.
Sourcepub async fn health(&self) -> Result<Value, EngineError>
pub async fn health(&self) -> Result<Value, EngineError>
GET /health, e.g. {"status":"ok","engine":"C++ WebAssembly"}.
Sourcepub async fn render_pdf(
&self,
print_data: &PrintData,
) -> Result<Vec<u8>, EngineError>
pub async fn render_pdf( &self, print_data: &PrintData, ) -> Result<Vec<u8>, EngineError>
Render a PrintData to PDF.
Sourcepub async fn render_pdf_json(
&self,
json: impl Into<Vec<u8>>,
) -> Result<Vec<u8>, EngineError>
pub async fn render_pdf_json( &self, json: impl Into<Vec<u8>>, ) -> Result<Vec<u8>, EngineError>
Render PREPEJ JSON (bytes or text) to PDF.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for ReportsWebEngine
impl !UnwindSafe for ReportsWebEngine
impl Freeze for ReportsWebEngine
impl Send for ReportsWebEngine
impl Sync for ReportsWebEngine
impl Unpin for ReportsWebEngine
impl UnsafeUnpin for ReportsWebEngine
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