Skip to main content

StdlibPrototypes

Struct StdlibPrototypes 

Source
pub struct StdlibPrototypes { /* private fields */ }
Expand description

Built-in C Standard Library Prototype Database

Contains all 150+ functions from ISO C99 §7

Implementations§

Source§

impl StdlibPrototypes

Source

pub fn new() -> Self

Create new prototype database with all C99 §7 functions

Source

pub fn get_prototype(&self, name: &str) -> Option<&FunctionProto>

Get prototype for a stdlib function by name

Source

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 string
Source

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.

Source

pub fn len(&self) -> usize

Get number of functions in database

Source

pub fn is_empty(&self) -> bool

Check if database is empty

Trait Implementations§

Source§

impl Default for StdlibPrototypes

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.