Skip to main content

same_text

Function same_text 

Source
pub const fn same_text(left: &str, right: &str) -> bool
Expand description

Whether two strings are the same text, usable in a const context. 两个字符串文本是否相同,可在 const 语境中使用。

One contract cannot be referenced from where it is used: include! and concat! only accept literals, so the generated entry’s file name has to be written out again at that one site. Pinning the two together with a const assertion turns a drift into a compile error instead of a host that includes a file the build step no longer writes. 有一条契约无法在使用处引用:include! 与 concat! 只接受字面量,因此生成入口 的文件名在那唯一一处只能再写一遍。用 const 断言把两者钉在一起,漂移就变成编译 错误,而不是去 include 一个构建步骤已不再写的文件。