pub struct StdlibPrototypes { /* private fields */ }Expand description
Built-in C Standard Library Prototype Database
Contains all 150+ functions from ISO C99 §7
§Examples
use decy_stdlib::StdlibPrototypes;
let db = StdlibPrototypes::default();
assert!(db.get_prototype("printf").is_some());Implementations§
Source§impl StdlibPrototypes
impl StdlibPrototypes
Sourcepub fn new() -> Self
pub fn new() -> Self
Create new prototype database with all C99 §7 functions.
Initializes 150+ function prototypes across 8 standard library headers: stdlib.h, stdio.h, string.h, ctype.h, time.h, math.h, unistd.h, dirent.h.
§Examples
use decy_stdlib::StdlibPrototypes;
let protos = StdlibPrototypes::new();
assert!(protos.get_prototype("malloc").is_some());
assert!(protos.get_prototype("printf").is_some());Sourcepub fn get_prototype(&self, name: &str) -> Option<&FunctionProto>
pub fn get_prototype(&self, name: &str) -> Option<&FunctionProto>
Get prototype for a stdlib function by name
Sourcepub fn inject_prototypes_for_header(&self, header: StdHeader) -> String
pub fn inject_prototypes_for_header(&self, header: StdHeader) -> String
Inject prototypes for a specific header
Only injects function declarations for the specified header. This prevents parser overload from injecting all 55+ prototypes at once.
§Examples
use decy_stdlib::{StdlibPrototypes, StdHeader};
let stdlib = StdlibPrototypes::new();
let string_protos = stdlib.inject_prototypes_for_header(StdHeader::String);
assert!(string_protos.contains("strlen"));
assert!(!string_protos.contains("printf")); // stdio function, not stringSourcepub fn inject_all_prototypes(&self) -> String
pub fn inject_all_prototypes(&self) -> String
Inject all stdlib prototypes as C declarations
Note: Prefer inject_prototypes_for_header() to avoid parser overload.
This method injects ALL 55+ prototypes which may cause parsing issues.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for StdlibPrototypes
impl RefUnwindSafe for StdlibPrototypes
impl Send for StdlibPrototypes
impl Sync for StdlibPrototypes
impl Unpin for StdlibPrototypes
impl UnsafeUnpin for StdlibPrototypes
impl UnwindSafe for StdlibPrototypes
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