pub struct Project {
pub project_file_path: Option<String>,
pub project_dir: Option<String>,
pub name: String,
pub bg_color: String,
pub json_version: String,
pub default_pivot_x: f64,
pub default_pivot_y: f64,
pub levels: Vec<Level>,
}
Fields§
§project_file_path: Option<String>
Contains the full path to the project JSON, as provided to the macro (using slashes)
project_dir: Option<String>
Contains the directory of the project JSON (using slashes, no trailing slash)
name: String
Project name
bg_color: String
Project background color as hex (e.g. #FFFFFF)
json_version: String
§default_pivot_x: f64
§default_pivot_y: f64
§levels: Vec<Level>
Implementations§
Source§impl Project
impl Project
Sourcepub fn parse_json(json: String) -> Result<Self, Error>
pub fn parse_json(json: String) -> Result<Self, Error>
Examples found in repository?
examples/iter_render_data.rs (line 18)
8fn parse_file(file_name: &str) -> Project {
9 let mut file_path = PathBuf::from(std::env::var("CARGO_MANIFEST_DIR").unwrap());
10 file_path.push("examples");
11 file_path.push(file_name);
12 file_path.set_extension("json");
13
14 let mut file = File::open(file_path).unwrap();
15 let mut contents = String::new();
16 file.read_to_string(&mut contents).unwrap();
17
18 Project::parse_json(contents).unwrap()
19}
More examples
examples/parse_sample.rs (line 17)
7fn parse_file(file_name: &str) -> Project {
8 let mut file_path = PathBuf::from(std::env::var("CARGO_MANIFEST_DIR").unwrap());
9 file_path.push("examples");
10 file_path.push(file_name);
11 file_path.set_extension("json");
12
13 let mut file = File::open(file_path).unwrap();
14 let mut contents = String::new();
15 file.read_to_string(&mut contents).unwrap();
16
17 Project::parse_json(contents).unwrap()
18}
examples/render_data.rs (line 18)
8fn parse_file(file_name: &str) -> Project {
9 let mut file_path = PathBuf::from(std::env::var("CARGO_MANIFEST_DIR").unwrap());
10 file_path.push("examples");
11 file_path.push(file_name);
12 file_path.set_extension("json");
13
14 let mut file = File::open(file_path).unwrap();
15 let mut contents = String::new();
16 file.read_to_string(&mut contents).unwrap();
17
18 Project::parse_json(contents).unwrap()
19}
examples/parse_empty.rs (line 17)
7fn parse_file(file_name: &str) {
8 let mut file_path = PathBuf::from(std::env::var("CARGO_MANIFEST_DIR").unwrap());
9 file_path.push("examples");
10 file_path.push(file_name);
11 file_path.set_extension("json");
12
13 let mut file = File::open(file_path).unwrap();
14 let mut contents = String::new();
15 file.read_to_string(&mut contents).unwrap();
16
17 println!("{:?}", Project::parse_json(contents).unwrap());
18}
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Project
impl<'de> Deserialize<'de> for Project
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl ToRenderGrid for Project
impl ToRenderGrid for Project
Source§fn to_merged_render_grid(&self, level: usize) -> Result<RenderGrid, Error>
fn to_merged_render_grid(&self, level: usize) -> Result<RenderGrid, Error>
Creates a render grid with the layers merged down into a single layer.
Excludes entity layers and intgrid layers but includes autotile and tile layers
Auto Trait Implementations§
impl Freeze for Project
impl RefUnwindSafe for Project
impl Send for Project
impl Sync for Project
impl Unpin for Project
impl UnwindSafe for Project
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