Skip to content

Commit af1b404

Browse files
committed
make it compile for android
- disable show/render functionality when target_os is android Signed-off-by: Andrei Gherghescu <8067229+andrei-ng@users.noreply.github.com>
1 parent 0301259 commit af1b404

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Diff for: plotly/src/plot.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ struct PlotTemplate<'a> {
2020

2121
#[derive(Template)]
2222
#[template(path = "static_plot.html", escape = "none")]
23-
#[cfg(not(target_family = "wasm"))]
23+
#[cfg(all(not(target_family = "wasm"), not(target_os = "android")))]
2424
struct StaticPlotTemplate<'a> {
2525
plot: &'a Plot,
2626
format: ImageFormat,
@@ -43,7 +43,7 @@ struct JupyterNotebookPlotTemplate<'a> {
4343
plot_div_id: &'a str,
4444
}
4545

46-
#[cfg(not(target_family = "wasm"))]
46+
#[cfg(all(not(target_family = "wasm"), not(target_os = "android")))]
4747
const DEFAULT_HTML_APP_NOT_FOUND: &str = r#"Could not find default application for HTML files.
4848
Consider using the `to_html` method obtain a string representation instead. If using the `kaleido` feature the
4949
`write_image` method can be used to produce a static image in one of the following formats:
@@ -246,7 +246,7 @@ impl Plot {
246246
///
247247
/// The HTML file is saved in a temp file, from which it is read and
248248
/// displayed by the browser.
249-
#[cfg(not(target_family = "wasm"))]
249+
#[cfg(all(not(target_family = "wasm"), not(target_os = "android")))]
250250
pub fn show(&self) {
251251
use std::env;
252252

@@ -278,7 +278,7 @@ impl Plot {
278278
/// The HTML file is generated and saved in the provided filename as long as
279279
/// the path already exists, after the file is saved, it is read and
280280
/// displayed by the browser.
281-
#[cfg(not(target_family = "wasm"))]
281+
#[cfg(all(not(target_family = "wasm"), not(target_os = "android")))]
282282
pub fn show_html<P: AsRef<Path> + std::clone::Clone>(&self, filename: P) {
283283
let path = filename.as_ref().to_str().unwrap();
284284
self.write_html(filename.clone());
@@ -288,7 +288,7 @@ impl Plot {
288288

289289
/// Display the fully rendered `Plot` as a static image of the given format
290290
/// in the default system browser.
291-
#[cfg(not(target_family = "wasm"))]
291+
#[cfg(all(not(target_family = "wasm"), not(target_os = "android")))]
292292
pub fn show_image(&self, format: ImageFormat, width: usize, height: usize) {
293293
use std::env;
294294

@@ -471,7 +471,7 @@ impl Plot {
471471
tmpl.render().unwrap()
472472
}
473473

474-
#[cfg(not(target_family = "wasm"))]
474+
#[cfg(all(not(target_family = "wasm"), not(target_os = "android")))]
475475
fn render_static(&self, format: ImageFormat, width: usize, height: usize) -> String {
476476
let tmpl = StaticPlotTemplate {
477477
plot: self,

0 commit comments

Comments
 (0)