Skip to main content

RustDeclDict

Struct RustDeclDict 

Source
pub struct RustDeclDict {
    pub consts: HashMap<String, RustConst>,
    pub fns: HashMap<String, RustFn>,
    pub structs: HashMap<String, RustStruct>,
    pub types: HashMap<String, RustTypeAlias>,
    pub enums: HashSet<String>,
    pub statics: HashSet<String>,
    pub static_arrays: HashSet<String>,
    pub static_types: HashMap<String, String>,
    pub bitfield_methods: HashMap<String, HashSet<String>>,
    pub bitfield_method_types: HashMap<(String, String), String>,
}
Expand description

Rust宣言辞書

Fields§

§consts: HashMap<String, RustConst>§fns: HashMap<String, RustFn>§structs: HashMap<String, RustStruct>§types: HashMap<String, RustTypeAlias>§enums: HashSet<String>§statics: HashSet<String>

全 extern static 変数名の集合

§static_arrays: HashSet<String>

配列型の extern static 変数名の集合

§static_types: HashMap<String, String>

static 変数の型マップ (名前 → Rust 型文字列) 例: “PL_c9_utf8_dfa_tab” → “[U8; 0usize]”

§bitfield_methods: HashMap<String, HashSet<String>>

ビットフィールドのメソッド名集合(構造体名 → メソッド名セット)

§bitfield_method_types: HashMap<(String, String), String>

ビットフィールドアクセサ getter の戻り値型 (構造体名, メソッド名) → 戻り値型文字列 例: (“op”, “op_type”) → “U16”

Implementations§

Source§

impl RustDeclDict

Source

pub fn new() -> Self

新しい辞書を作成

Source

pub fn parse_file<P: AsRef<Path>>(path: P) -> Result<Self>

ファイルからパース

Source

pub fn intern_names(&self, interner: &mut StringInterner)

全 struct / typedef / enum 名を StringInterner に intern する。

bindgen が生成する pmop__bindgen_ty_2 のような名前は通常 C ヘッダ側の パースでは登場しないため interner に未登録のまま。後段の型推論で from_apidoc_string("pmop__bindgen_ty_2", interner) のように interner.lookup() を経由する経路は immutable な interner しか見ないので、 パース直後に明示的に intern しておく必要がある。

Source

pub fn parse(content: &str) -> Self

文字列からパース

Source

pub fn stats(&self) -> RustDeclStats

統計情報を取得

Source

pub fn thx_functions(&self) -> HashSet<String>

THX依存関数の名前を取得

第一引数が *mut PerlInterpreter を含む関数を返す

Source

pub fn dump(&self) -> String

辞書をダンプ

Source

pub fn lookup_const(&self, name: &str) -> Option<&RustConst>

名前で定数を検索

Source

pub fn lookup_fn(&self, name: &str) -> Option<&RustFn>

名前で関数を検索

Source

pub fn lookup_struct(&self, name: &str) -> Option<&RustStruct>

名前で構造体を検索

Source

pub fn lookup_type(&self, name: &str) -> Option<&RustTypeAlias>

名前で型エイリアスを検索

Trait Implementations§

Source§

impl Debug for RustDeclDict

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for RustDeclDict

Source§

fn default() -> RustDeclDict

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.