CompoundTermRef

Struct CompoundTermRef 

Source
pub struct CompoundTermRef<'a> {
    pub inner: &'a Term,
    pub components: &'a [Term],
}
Expand description

🆕作为「复合词项引用」的词项类型

  • 🎯在程序类型层面表示一个「复合词项」(不可变引用)

Fields§

§inner: &'a Term

复合词项整体

§components: &'a [Term]

复合词项的元素列表

Implementations§

Source§

impl<'s> CompoundTermRef<'s>

Source

pub fn size(&self) -> usize

📄OpenNARS CompoundTerm.size

  • 🚩直接链接到TermComponents的属性
  • ⚠️对「像」不包括「像占位符」
    • 📄(/, A, _, B)size2而非3
§📄OpenNARS

get the number of components

Source

pub fn component_at(self, index: usize) -> Option<&'s Term>

📄OpenNARS CompoundTerm.componentAt

  • 🚩直接连接到TermComponents的方法
  • ⚠️对「像」不受「像占位符」位置影响
§📄OpenNARS

get a component by index

Source

pub unsafe fn component_at_unchecked(&self, index: usize) -> &Term

📄OpenNARS CompoundTerm.componentAt

  • 🆕unsafe版本:若已知词项的组分数,则可经此对症下药
  • 🚩直接连接到TermComponents的方法
  • ⚠️对「像」不受「像占位符」位置影响
§Safety

⚠️只有在「确保索引不会越界」才不会引发panic

§📄OpenNARS

get a component by index

Source

pub fn index_of_component(&self, t: &Term) -> Option<usize>

🆕改版 CompoundTerm.indexOfComponent

@param t & @return [] index or -1

Source

pub fn clone_components(&self) -> Vec<Term>

📄OpenNARS CompoundTerm.cloneComponents

  • 🚩【2024-06-14 10:43:03】遵照改版原意,使用变长数组
    • ℹ️后续需要增删操作
    • 📝无论如何也绕不开Vec
§📄OpenNARS

Clone the component list

Source

pub fn clone_component_refs(&self) -> Vec<&Term>

📄OpenNARS CompoundTerm.cloneComponents

  • 🚩只拷贝所有元素的引用,无需拷贝其中的值
Source

pub fn contain_component(&self, component: &Term) -> bool

📄OpenNARS CompoundTerm.containComponent

  • 🎯检查其是否包含直接组分
  • 🚩直接基于已有迭代器方法
§📄OpenNARS

Check whether the compound contains a certain component

Source

pub fn contain_term(&self, term: &Term) -> bool

📄OpenNARS CompoundTerm.containTerm

  • 🎯检查其是否递归包含组分
  • 🚩直接基于已有迭代器方法:词项 == 组分 || 词项 in 组分
§📄OpenNARS

Recursively check if a compound contains a term

Source

pub fn contain_all_components(&self, other: &Term) -> bool

📄OpenNARS CompoundTerm.containAllComponents

  • 🎯分情况检查「是否包含所有组分」
    • 📌同类⇒检查其是否包含other的所有组分
    • 📌异类⇒检查其是否包含other作为整体
  • 🚩直接基于已有迭代器方法
§📄OpenNARS

Check whether the compound contains all components of another term, or that term as a whole

Source

pub fn as_conditional(self) -> Option<(StatementRef<'s>, CompoundTermRef<'s>)>

🆕作为「条件句」使用

! ❌【2024-07-05 17:04:02】不再考虑支持「等价」陈述的词项链转换,同时也不再将「等价陈述」视作「条件句」

Source§

impl CompoundTermRef<'_>

Source

pub fn reduce_components(self, component_to_reduce: &Term) -> Option<Term>

删去元素

  • 🚩从复合词项中删去一个元素,或从同类复合词项中删除所有其内元素,然后尝试约简
  • ⚠️结果可空
Source

pub fn set_component(self, index: usize, term: Option<Term>) -> Option<Term>

替换词项

  • 🚩替换指定索引处的词项,始终返回替换后的新词项
  • 🚩若要替换上的词项为空(⚠️t可空),则与「删除元素」等同
  • ⚠️结果可空
Source§

impl<'a> CompoundTermRef<'a>

Source

pub fn get_placeholder_index(self) -> usize

📄OpenNARS getRelationIndex 属性

  • 🎯用于获取「像」的关系索引
  • 🆕⚠️现在是获取「占位符位置」
    • 📝原先OpenNARS是将「关系词项」放在占位符处的,现在是根据《NAL》原意,将「关系词项」统一放在「第一个词项」处
    • 📌所以后续所有的「索引」都变成了「占位符位置」
    • 💭【2024-05-11 14:40:15】后续可能会在这点上有隐患——随后要注意这种差别
§Panics

! ⚠️仅限于「像」的TermComponents::MultiIndexed词项

  • 若尝试获取「非『像』词项」的关系索引,则会panic
  • 🚩【2024-06-12 22:53:09】本来就不应该对「非像词项」调用该函数——严格跟「像」类型绑定
§📄OpenNARS

get the index of the relation in the component list

@return the index of relation

Source

pub fn get_relation(self) -> &'a Term

📄OpenNARS getRelation 属性

  • 🎯用于获取「像」的「关系词项」
  • ⚠️若尝试获取「非『像』词项」的关系词项,则会panic
  • 🆕按NARust「索引=占位符索引」的来:总是在索引0
§📄OpenNARS

Get the relation term in the Image

@return The term representing a relation

Source

pub fn get_the_other_component(self) -> Option<&'a Term>

📄OpenNARS getTheOtherComponent 属性

  • 🎯用于获取「像」的「另一词项」
  • ⚠️若尝试获取「非『像』词项」的词项,则会panic
§📄OpenNARS

Get the other term in the Image

@return The term related

Source§

impl<'s> CompoundTermRef<'s>

为「复合词项」添加「转换到陈述」的方法

  • 📌依据:陈述 ⊂ 复合词项
Source

pub fn is_statement(&self) -> bool

🆕判断一个复合词项是否为「陈述词项」

Source

pub fn as_statement(self) -> Option<StatementRef<'s>>

🆕将一个复合词项转换为「陈述词项」(不可变引用)

Methods from Deref<Target = Term>§

Source

pub fn identifier(&self) -> &str

只读的「标识符」属性

Source

pub fn components(&self) -> &TermComponents

只读的「组分」属性

Source

pub fn is_placeholder(&self) -> bool

判断其是否为「占位符」

  • 🎯【2024-04-21 01:04:17】在「词法折叠」中首次使用
Source

pub fn id_comp(&self) -> (&str, &TermComponents)

快捷获取「标识符-组分」二元组

  • 🎯用于很多地方的「类型匹配」
Source

pub fn contain_type(&self, identifier: &str) -> bool

判断「是否包含指定类型的词项」

  • 🎯支持「词项」中的方法,递归判断「是否含有变量」
Source

pub fn for_each_atom(&self, f: &mut impl FnMut(&Term))

遍历其中所有原子词项

  • 🎯找到其中所有的变量
  • ⚠️外延像/内涵像 中的占位符
  • ⚠️需要传入闭包的可变引用,而非闭包本身
    • 📌中间「递归深入」需要重复调用(传入)闭包
  • 📄词语、变量
  • 📄占位符
Source

pub fn format_name(&self) -> String

格式化名称

  • 🚩以方便打印的「内部方言语法」呈现Narsese
    • 📌括号全用 圆括号
    • 📌无逗号分隔符
Source

pub fn to_lexical(&self) -> TermLexical

从「内部Narsese」转换为「词法Narsese」

  • 🚩基本无损转换(无需考虑失败情况)
Source

pub fn format_ascii(&self) -> String

转换为显示呈现上的ASCII格式

  • 📌对标OpenNARS的默认呈现
  • ⚠️【2024-07-02 00:52:54】目前需要「词法Narsese」作为中间格式,可能会有性能损失
Source

pub fn name(&self) -> String

模拟Term.getName

  • 🆕使用自身内建的「获取名称」方法
    • 相较OpenNARS更
    • 仍能满足OpenNARS的需求
  • 🎯OpenNARS原有需求
    • 📌保证「词项不同 ⇔ 名称不同」
    • 📌保证「可用于『概念』『记忆区』的索引」
§📄OpenNARS

Reporting the name of the current Term.

@return The name of the term as a String

Source

pub fn complexity(&self) -> usize

模拟Term.getComplexity

  • 🚩逻辑 from OpenNARS
    • 原子 ⇒ 1
    • 变量 ⇒ 0
    • 复合 ⇒ 1 + 所有组分复杂度之和
§📄OpenNARS
  • The syntactic complexity, for constant atomic Term, is 1.
  • The complexity of the term is the sum of those of the components plus 1
  • The syntactic complexity of a variable is 0, because it does not refer to * any concept.

@return The complexity of the term, an integer

Source

pub fn is_zero_complexity(&self) -> bool

🆕判断是否为「零复杂度」

  • 🎯用于部分「除以复杂度」的函数
Source

pub fn is_same_type(&self, other: &Self) -> bool

🆕用于替代Java的x.getClass() == y.getClass()

Source

pub fn instanceof_compound_pure(&self) -> bool

🆕用于判断是否为「纯复合词项」

  • ⚠️包括陈述
Source

pub fn as_compound_type( &self, compound_class: impl AsRef<str>, ) -> Option<CompoundTermRef<'_>>

🆕用于判断词项是否为「指定类型的复合词项」,并尝试返回「复合词项」的引用信息

  • 📌包括陈述
  • 🚩模式匹配后返回一个Option,只在其为「符合指定类型的词项」时为Some
  • 🚩返回不可变引用
Source

pub fn instanceof_compound(&self) -> bool

🆕用于判断是否为「复合词项」

  • ⚠️包括陈述
  • 📄OpenNARS instanceof CompoundTerm 逻辑
Source

pub fn instanceof_set_ext(&self) -> bool

🆕用于判断是否为「外延集」

Source

pub fn instanceof_set_int(&self) -> bool

🆕用于判断是否为「内涵集」

Source

pub fn instanceof_set(&self) -> bool

🆕用于判断是否为「词项集」

  • 📄OpenNARSinstanceof SetExt || instanceof SetInt逻辑
Source

pub fn instanceof_intersection_ext(&self) -> bool

🆕用于判断是否为「外延交」

  • 📄OpenNARSinstanceof IntersectionExt逻辑
  • 🎯crate::inference推理规则分派
Source

pub fn instanceof_intersection_int(&self) -> bool

🆕用于判断是否为「内涵交」

  • 📄OpenNARSinstanceof IntersectionInt逻辑
  • 🎯crate::inference推理规则分派
Source

pub fn instanceof_intersection(&self) -> bool

🆕用于判断是否为「词项交集」

  • 📄OpenNARSinstanceof IntersectionExt || instanceof IntersectionInt逻辑
  • 🎯首次用于[crate::inference::StructuralRules::__switch_order]
Source

pub fn instanceof_difference_ext(&self) -> bool

🆕用于判断是否为「外延差」

  • 📄OpenNARSinstanceof DifferenceExt逻辑
  • 🎯crate::inference推理规则分派
Source

pub fn instanceof_difference_int(&self) -> bool

🆕用于判断是否为「内涵差」

  • 📄OpenNARSinstanceof DifferenceInt逻辑
  • 🎯crate::inference推理规则分派
Source

pub fn instanceof_difference(&self) -> bool

🆕用于判断是否为「词项差集」

  • 📄OpenNARSinstanceof DifferenceExt || instanceof DifferenceInt逻辑
Source

pub fn instanceof_product(&self) -> bool

🆕用于判断是否为「乘积」

Source

pub fn instanceof_image_ext(&self) -> bool

🆕用于判断是否为「外延像」

Source

pub fn instanceof_image_int(&self) -> bool

🆕用于判断是否为「内涵像」

Source

pub fn instanceof_image(&self) -> bool

🆕用于判断是否为「像」

  • 📄OpenNARSinstanceof ImageExt || instanceof ImageInt逻辑
Source

pub fn instanceof_conjunction(&self) -> bool

🆕用于判断是否为「合取」

  • 📄OpenNARSinstanceof Conjunction逻辑
  • 🎯crate::inference推理规则分派
Source

pub fn instanceof_disjunction(&self) -> bool

🆕用于判断是否为「析取」

  • 📄OpenNARSinstanceof Disjunction逻辑
  • 🎯crate::inference推理规则分派
Source

pub fn instanceof_junction(&self) -> bool

🆕用于判断是否为「词项差集」

  • 📄OpenNARSinstanceof Conjunction || instanceof Disjunction逻辑
Source

pub fn instanceof_negation(&self) -> bool

🆕用于判断是否为「否定」

Source

pub fn is_commutative(&self) -> bool

📄OpenNARS CompoundTerm.isCommutative

  • 📌对「零元/一元 词项」默认为「不可交换」
    • 📜返回false
    • 📄OpenNARS中Negation的定义(即默认「不可交换」)
§📄OpenNARS

Check if the order of the components matters

Commutative CompoundTerms: Sets, Intersections Commutative Statements: Similarity, Equivalence (except the one with a temporal order) Commutative CompoundStatements: Disjunction, Conjunction (except the one with a temporal order)

Source

pub fn structural_match(&self, other: &Self) -> bool

判断和另一词项是否「结构匹配」

  • 🎯变量替换中的模式匹配
  • 🚩类型匹配 & 组分匹配
  • ⚠️非递归:不会递归比较「组分是否对应匹配」
Source

pub fn is_compound(&self) -> bool

🆕判断是否真的是「复合词项」

  • 🚩通过判断「内部元素枚举」的类型实现
  • 🎯用于后续「作为复合词项」使用
    • ✨以此在程序层面表示「复合词项」类型
Source

pub fn as_compound(&self) -> Option<CompoundTermRef<'_>>

🆕尝试将词项作为「复合词项」

  • 📌通过判断「内部元素枚举」的类型实现
  • 🚩在其内部元素不是「复合词项」时,会返回None
Source

pub fn as_compound_and( &self, predicate: impl FnOnce(&CompoundTermRef<'_>) -> bool, ) -> Option<CompoundTermRef<'_>>

🆕尝试将词项作为「复合词项」

  • 📌通过判断「内部元素枚举」的类型实现
  • 🚩在其内部元素不是「复合词项」时,会返回None
Source

pub unsafe fn as_compound_unchecked(&self) -> CompoundTermRef<'_>

🆕尝试将词项作为「复合词项」(未检查)

  • 🚩通过判断「内部元素枚举」的类型实现
§Safety
  • ⚠️代码是不安全的:必须在解包前已经假定是「复合词项」
  • 📄逻辑参考自Option::unwrap_unchecked
Source

pub fn instanceof_variable(&self) -> bool

用于判断是否为「变量词项」

Source

pub fn instanceof_variable_i(&self) -> bool

🆕用于判断「是否为独立变量」

Source

pub fn instanceof_variable_d(&self) -> bool

🆕用于判断「是否为非独变量」

Source

pub fn instanceof_variable_q(&self) -> bool

🆕用于判断「是否为查询变量」

Source

pub fn as_variable(&self) -> Option<usize>

尝试匹配出「变量」,并返回其中的编号(若有)

Source

pub fn is_constant(&self) -> bool

📄OpenNARS Term.isConstant 属性

  • 🚩检查其是否为「常量」:自身是否「不含变量」

  • 🎯决定其是否能成为一个「概念」(被作为「概念」存入记忆区)

  • ❓OpenNARS中在「构造语句」时又会将isConstant属性置为true,这是为何

    • 📝被Sentence(..)调用的CompoundTerm.renameVariables()会直接将词项「视作常量」
    • 💭这似乎是被认为「即便全是变量,只要是【被作为语句输入过】的,就会被认作是『常量』」
    • 📝然后这个「是否常量」会在「记忆区」中被认作「是否能从中获取概念」的依据:if (!term.isConstant()) { return null; }
  • 🚩【2024-04-21 23:46:12】现在变为「只读属性」:接受OpenNARS中有关「设置语句时/替换变量后 变为『常量』」的设定

    • 💫【2024-04-22 00:03:10】后续仍然有一堆复杂逻辑要考虑
  • ✅【2024-06-19 02:06:12】跟随最新改版更新,删去字段并铺开实现此功能

  • ♻️【2024-06-26 02:07:27】重构修正:禁止「占位符」作为「常量词项」

  • ♻️【2024-07-31 21:41:49】修正:不再将查询变量计入「常量词项」

§📄OpenNARS

Check whether the current Term can name a Concept.

  • A Term is constant by default
  • A variable is not constant
  • (for CompoundTerm) check if the term contains free variable
Source

pub fn contain_var(&self) -> bool

📄OpenNARS Variable.containVar 方法

  • 🚩检查其是否「包含变量」
    • 自身为「变量词项」或者其包含「变量词项」
  • 🎯用于决定复合词项是否为「常量」
  • 📝OpenNARS中对于复合词项的isConstant属性采用「惰性获取」的机制
    • isConstant作为!Variable.containVar(name)进行初始化
  • 🆕实现方法:不同于OpenNARS「直接从字符串中搜索子串」的方式,基于递归方法设计
§📄OpenNARS

Check whether a string represent a name of a term that contains a variable

Source

pub fn contain_var_i(&self) -> bool

📄OpenNARS Variable.containVarI 方法

  • 🎯判断「是否包含指定类型的变量」
  • 🚩通过「判断是否包含指定标识符的词项」完成判断
Source

pub fn contain_var_d(&self) -> bool

📄OpenNARS Variable.containVarD 方法

  • 🎯判断「是否包含指定类型的变量」
  • 🚩通过「判断是否包含指定标识符的词项」完成判断
Source

pub fn contain_var_q(&self) -> bool

📄OpenNARS Variable.containVarQ 方法

  • 🎯判断「是否包含指定类型的变量」
  • 🚩通过「判断是否包含指定标识符的词项」完成判断
Source

pub fn get_variable_type(&self) -> &str

📄OpenNARS Variable.getType 方法

  • 🎯在OpenNARS中仅用于「判断变量类型相等」
  • 🚩归并到「判断词项标识符相等」
§📄OpenNARS

Get the type of the variable

Source

pub fn instanceof_statement(&self) -> bool

🆕用于判断是否为「陈述词项」

  • 📄OpenNARS instanceof Statement 逻辑
Source

pub fn instanceof_inheritance(&self) -> bool

🆕用于判断是否为「继承」

  • 📄OpenNARSinstanceof Inheritance逻辑
  • 📝OpenNARS中「继承」与「实例」「属性」「实例属性」没有继承关系
  • 🎯[crate::inference::RuleTables]推理规则分派
Source

pub fn instanceof_similarity(&self) -> bool

🆕用于判断是否为「相似」

  • 📄OpenNARSinstanceof Similarity逻辑
  • 🎯[crate::inference::RuleTables]推理规则分派
Source

pub fn instanceof_implication(&self) -> bool

🆕用于判断是否为「蕴含」

  • 📄OpenNARSinstanceof Implication逻辑
  • 🎯[crate::inference::RuleTables]推理规则分派
Source

pub fn instanceof_equivalence(&self) -> bool

🆕用于判断是否为「等价」

  • 📄OpenNARSinstanceof Equivalence逻辑
  • 🎯[crate::inference::RuleTables]推理规则分派
Source

pub fn is_statement(&self) -> bool

🆕判断一个词项是否为「陈述词项」

  • 🚩判断其「内部元素」的个数是否为2,并且要判断其标识符
  • 🚩【2024-09-07 14:59:00】现在采用更严格的条件——需要判断是否为「陈述系词」
Source

pub fn as_statement(&self) -> Option<StatementRef<'_>>

🆕将一个复合词项转换为「陈述词项」(不可变引用)

  • 🚩转换为Option
  • 🚩【2024-09-07 14:59:00】现在采用更严格的条件——需要判断是否为「陈述系词」
Source

pub fn as_statement_type( &self, statement_class: impl AsRef<str>, ) -> Option<StatementRef<'_>>

🆕用于判断词项是否为「指定类型的复合词项」,并尝试返回「复合词项」的引用信息

  • 📌包括陈述
  • 🚩模式匹配后返回一个Option,只在其为「符合指定类型的词项」时为Some
  • 🚩返回不可变引用

Trait Implementations§

Source§

impl<'a> Clone for CompoundTermRef<'a>

Source§

fn clone(&self) -> CompoundTermRef<'a>

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for CompoundTermRef<'a>

Source§

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

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

impl Deref for CompoundTermRef<'_>

向词项本身的自动解引用

  • 🎯让「复合词项引用」可以被看作是一个普通的词项
Source§

type Target = Term

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl Display for CompoundTermRef<'_>

转发「呈现」方法到「内部词项」

Source§

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

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

impl<'s> From<CompoundTermRefMut<'s>> for CompoundTermRef<'s>

可变引用 ⇒ 不可变引用

Source§

fn from(r: CompoundTermRefMut<'s>) -> Self

Converts to this type from the input type.
Source§

impl<'a> Hash for CompoundTermRef<'a>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<'a> PartialEq for CompoundTermRef<'a>

Source§

fn eq(&self, other: &CompoundTermRef<'a>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> Copy for CompoundTermRef<'a>

Source§

impl<'a> Eq for CompoundTermRef<'a>

Source§

impl<'a> StructuralPartialEq for CompoundTermRef<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for CompoundTermRef<'a>

§

impl<'a> RefUnwindSafe for CompoundTermRef<'a>

§

impl<'a> Send for CompoundTermRef<'a>

§

impl<'a> Sync for CompoundTermRef<'a>

§

impl<'a> Unpin for CompoundTermRef<'a>

§

impl<'a> UnwindSafe for CompoundTermRef<'a>

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> BoostWithOption for T

Source§

fn option<C>(self, criterion: C) -> Option<Self>
where C: FnOnce(&Self) -> bool,

根据某条件把自身变为可选值 Read more
Source§

fn some(self) -> Option<Self>

将自身封装为Some Read more
Source§

fn none(self) -> Option<Self>

将自身封装为None 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> JoinTo for T

Source§

fn join_to<S>(self, out: &mut String, sep: impl AsRef<str>)
where Self: Sized + Iterator<Item = S>, S: AsRef<str>,

将字串集中拼接到一个「目标字串」中,中途不创建任何辅助字符串 Read more
Source§

fn join_to_new<S>(self, sep: impl AsRef<str>) -> String
where Self: Sized + Iterator<Item = S>, S: AsRef<str>,

将字串集中拼接到一个新字串中 Read more
Source§

fn join_to_multi<S>(self, out: &mut String, sep: &[impl AsRef<str>])
where Self: Sized + Iterator<Item = S>, S: AsRef<str>,

将字串集中拼接到一个「目标字串」中,使用多个分隔符,中途不创建任何辅助字符串 Read more
Source§

fn join_to_multi_new<S>(self, sep: &[impl AsRef<str>]) -> String
where Self: Sized + Iterator<Item = S>, S: AsRef<str>,

将字串集中拼接到一个新字串中,使用多个分隔符 Read more
Source§

impl<T> JoinTo for T

Source§

fn join_to<S>(self, out: &mut String, sep: impl AsRef<str>)
where Self: Sized + Iterator<Item = S>, S: AsRef<str>,

将字串集中拼接到一个「目标字串」中,中途不创建任何辅助字符串 Read more
Source§

fn join_to_new<S>(self, sep: impl AsRef<str>) -> String
where Self: Sized + Iterator<Item = S>, S: AsRef<str>,

将字串集中拼接到一个新字串中 Read more
Source§

fn join_to_multi<S>(self, out: &mut String, sep: &[impl AsRef<str>])
where Self: Sized + Iterator<Item = S>, S: AsRef<str>,

将字串集中拼接到一个「目标字串」中,使用多个分隔符,中途不创建任何辅助字符串 Read more
Source§

fn join_to_multi_new<S>(self, sep: &[impl AsRef<str>]) -> String
where Self: Sized + Iterator<Item = S>, S: AsRef<str>,

将字串集中拼接到一个新字串中,使用多个分隔符 Read more
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToDebug for T
where T: Debug,

Source§

fn to_debug(&self) -> String

将对象转换为「用Debug格式化的字符串」

Source§

impl<T> ToDebug for T
where T: Debug,

Source§

fn to_debug(&self) -> String

将对象转换为「用Debug格式化的字符串」

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> Void for T

Source§

fn void(self)

Source§

impl<T> Void for T

Source§

fn void(self)