Crate libreda_oasis
source ·Expand description
Library for reading and writing OASIS files.
OASIS is a binary format for storing two-dimensional geometrical data as it is commonly used for silicon chip layouts. Its purpose is very similar to the older GDS2 format.
§Examples
§Read a layout from OASIS
use std::fs::File;
use libreda_oasis::OASISStreamReader;
// Import the `LayoutStreamReader` trait.
use libreda_db::prelude::*;
let filename = "./tests/data/INVX1_no_compression.oas";
// Open the OASIS file for reading.
let mut f = File::open(filename).unwrap();
// Create an empty layout that will be populated by the OASIS reader.
let mut layout = Chip::new();
// Create a default OASIS reader and parse the data from the file.
let result = OASISStreamReader::default()
.read_layout(&mut f, &mut layout);
// Assert that there was no error.
assert!(result.is_ok());
§Write a layout to OASIS
use std::fs::File;
use libreda_oasis::OASISStreamWriter;
// Import the `LayoutStreamReader` trait.
use libreda_db::prelude::*;
// Create an empty layout.
let layout = Chip::new();
let mut f = File::create("./tests/data/empty_layout_out.oas").unwrap();
let writer = OASISStreamWriter::default();
// Write the (empty) layout to the file.
let write_result = writer.write_layout(&mut f, &layout);
// Assert that there was no error.
assert!(write_result.is_ok());
§References
Re-exports§
pub use libreda_db;
Structs§
- Reader for the OASIS file format.
- Writer for the OASIS file format.
- Configuration for the output stream format.
Traits§
- Most basic trait of a layout.
- Trait for layouts that support editing.
- Trait for reading a layout from a byte stream.
- Trait for writing a layout to a byte stream.