Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
9aaf52b6
R
Rust
项目概览
int
/
Rust
接近 1 年 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rust
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
9aaf52b6
编写于
1月 30, 2022
作者:
G
George Bateman
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
(#93392) Update char::MAX docs and core::char::MAX
上级
2fb617ca
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
22 addition
and
12 deletion
+22
-12
library/core/src/char/methods.rs
library/core/src/char/methods.rs
+11
-6
library/core/src/char/mod.rs
library/core/src/char/mod.rs
+11
-6
未找到文件。
library/core/src/char/methods.rs
浏览文件 @
9aaf52b6
...
...
@@ -9,14 +9,19 @@
#[lang
=
"char"
]
impl
char
{
/// The highest valid code point a `char` can have,
0x10FFFF
.
/// The highest valid code point a `char` can have,
`'\u{10FFFF}'`
.
///
/// A [Code Point] is any value between zero and `char::MAX`, inclusive. A
/// `char` is a [Unicode Scalar Value], which is a Code Point that is not
/// in the range `0xD800..=0xDFFF`.
/// # Examples
///
/// ```
/// # fn something_which_returns_char() -> char { 'a' }
/// let c: char = something_which_returns_char();
/// assert!(c <= char::MAX);
///
/// [Unicode Scalar Value]: https://www.unicode.org/glossary/#unicode_scalar_value
/// [Code Point]: https://www.unicode.org/glossary/#code_point
/// let value_at_max = char::MAX as u32;
/// assert_eq!(char::from_u32(value_at_max), Some('\u{10FFFF}'));
/// assert_eq!(char::from_u32(value_at_max + 1), None);
/// ```
#[stable(feature
=
"assoc_char_consts"
,
since
=
"1.52.0"
)]
pub
const
MAX
:
char
=
'\
u
{
10
ffff
}
'
;
...
...
library/core/src/char/mod.rs
浏览文件 @
9aaf52b6
...
...
@@ -89,14 +89,19 @@
Cn Unassigned a reserved unassigned code point or a noncharacter
*/
/// The highest valid code point a `char` can have.
/// The highest valid code point a `char` can have
, `'\u{10FFFF}'`
.
///
/// A [`char`] is a [Unicode Scalar Value], which means that it is a [Code
/// Point], but only ones within a certain range. `MAX` is the highest valid
/// code point that's a valid [Unicode Scalar Value].
/// # Examples
///
/// [Unicode Scalar Value]: https://www.unicode.org/glossary/#unicode_scalar_value
/// [Code Point]: https://www.unicode.org/glossary/#code_point
/// ```
/// # fn something_which_returns_char() -> char { 'a' }
/// let c: char = something_which_returns_char();
/// assert!(c <= char::MAX);
///
/// let value_at_max = char::MAX as u32;
/// assert_eq!(char::from_u32(value_at_max), Some('\u{10FFFF}'));
/// assert_eq!(char::from_u32(value_at_max + 1), None);
/// ```
#[stable(feature
=
"rust1"
,
since
=
"1.0.0"
)]
pub
const
MAX
:
char
=
char
::
MAX
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录