MCU backend: build with no_std

This commit is contained in:
Olivier Goffart 2021-11-30 16:30:40 +01:00 committed by Olivier Goffart
parent 6ca63aac9c
commit 691d43d416
3 changed files with 19 additions and 7 deletions

View file

@ -18,13 +18,18 @@ only be used with `version = "=x.y.z"` in Cargo.toml.
*/
#![doc(html_logo_url = "https://sixtyfps.io/resources/logo.drawio.svg")]
#![cfg_attr(not(feature = "simulator"), no_std)]
extern crate alloc;
use alloc::boxed::Box;
use alloc::rc::Rc;
use alloc::string::String;
use sixtyfps_corelib::{
graphics::{Image, Size},
window::Window,
ImageInner,
};
use std::rc::Rc;
#[cfg(feature = "simulator")]
mod simulator;
@ -33,7 +38,6 @@ mod simulator;
use simulator::*;
mod renderer;
pub struct Backend;
impl sixtyfps_corelib::backend::Backend for Backend {
@ -101,5 +105,5 @@ pub const HAS_NATIVE_STYLE: bool = false;
pub const IS_AVAILABLE: bool = true;
pub fn init() {
sixtyfps_corelib::backend::instance_or_init(|| Box::new(Backend));
sixtyfps_corelib::backend::instance_or_init(|| alloc::boxed::Box::new(Backend));
}