pub struct FunctionData {
pub shared: Rc<SharedFnInfo>,
pub closure: Rc<RefCell<Scope>>,
pub bound_this: Option<Rc<Value>>,
}Expand description
ユーザー定義関数のデータ(静的情報 + クロージャ環境)。
【2026-11-02】静的メタデータ(名前・引数・本体・フラグ)を SharedFnInfo へ切り出し、
関数インスタンスのサイズを 56→24 バイトへ 57% 縮小(YouTube 視聴ページの生存関数約 23 万個で
約 7.36MB 削減、TODO A7a)。
【2026-11-03】24 バイトになったため ObjKind::Function(FunctionData) として ObjKind(32 バイト)内に
インライン格納し、関数ごとの Rc<FunctionData> ヒープ確保(約 23 万ブロック・約 11〜14MB)を廃止。
Fields§
§closure: Rc<RefCell<Scope>>クロージャが捕捉した定義時スコープ。
bound_this: Option<Rc<Value>>アロー関数が捕捉した this。
Implementations§
Source§impl FunctionData
impl FunctionData
pub fn name(&self) -> &str
pub fn name_rc(&self) -> Rc<str>
pub fn params(&self) -> &Rc<Vec<Param>>
pub fn body(&self) -> &Rc<FnBody>
pub fn is_arrow(&self) -> bool
pub fn is_async(&self) -> bool
pub fn is_generator(&self) -> bool
pub fn has_simple_unique_params(&self) -> bool
pub fn set_name(&mut self, name: &str)
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for FunctionData
impl !Send for FunctionData
impl !Sync for FunctionData
impl !UnwindSafe for FunctionData
impl Freeze for FunctionData
impl Unpin for FunctionData
impl UnsafeUnpin for FunctionData
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