extend public api

This commit is contained in:
NikVolf 2017-06-19 21:18:16 +03:00
parent a200bd0862
commit 06aaf4a750
2 changed files with 25 additions and 1 deletions

View File

@ -17,7 +17,7 @@ pub use self::module::Module;
pub use self::section::{
Section, FunctionSection, CodeSection, MemorySection, DataSection,
ImportSection, ExportSection, GlobalSection, TypeSection, ElementSection,
TableSection,
TableSection, CustomSection,
};
pub use self::import_entry::{ImportEntry, ResizableLimits, MemoryType, TableType, GlobalType, External};
pub use self::export_entry::{ExportEntry, Internal};

View File

@ -178,11 +178,35 @@ impl Serialize for Section {
}
}
/// Custom section
pub struct CustomSection {
name: String,
payload: Vec<u8>,
}
impl CustomSection {
/// Name of the custom section
pub fn name(&self) -> &str {
&self.name
}
/// Payload of the custom secion
pub fn payload(&self) -> &[u8] {
&self.payload
}
/// Name of the custom section (mutable)
pub fn name_mut(&mut self) -> &mut String {
&mut self.name
}
/// Payload of the custom section (mutable)
pub fn payload_mut(&mut self) -> &mut Vec<u8> {
&mut self.payload
}
}
impl Deserialize for CustomSection {
type Error = Error;