Skip to main content

FunctionData

Struct FunctionData 

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

§shared: Rc<SharedFnInfo>§closure: Rc<RefCell<Scope>>

クロージャが捕捉した定義時スコープ。

§bound_this: Option<Rc<Value>>

アロー関数が捕捉した this。

Implementations§

Source§

impl FunctionData

Source

pub fn name(&self) -> &str

Source

pub fn name_rc(&self) -> Rc<str>

Source

pub fn params(&self) -> &Rc<Vec<Param>>

Source

pub fn body(&self) -> &Rc<FnBody>

Source

pub fn is_arrow(&self) -> bool

Source

pub fn is_async(&self) -> bool

Source

pub fn is_generator(&self) -> bool

Source

pub fn has_simple_unique_params(&self) -> bool

Source

pub fn set_name(&mut self, name: &str)

Trait Implementations§

Source§

impl Clone for FunctionData

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.