mirror of
https://github.com/typst/typst
synced 2025-05-14 04:56:26 +08:00
Document exceptions and alternatives to using type
(#6027)
Co-authored-by: Zedd Serjeant <Zedd.Serjeant@PumpkinEng.com.au> Co-authored-by: Laurenz <laurmaedje@gmail.com>
This commit is contained in:
parent
43c3d5d3af
commit
9829bd8326
@ -39,11 +39,25 @@ use crate::foundations::{
|
||||
/// #type(image("glacier.jpg")).
|
||||
/// ```
|
||||
///
|
||||
/// The type of `10` is `int`. Now, what is the type of `int` or even `type`?
|
||||
/// The type of `{10}` is `int`. Now, what is the type of `int` or even `type`?
|
||||
/// ```example
|
||||
/// #type(int) \
|
||||
/// #type(type)
|
||||
/// ```
|
||||
///
|
||||
/// Unlike other types like `int`, [none] and [auto] do not have a name
|
||||
/// representing them. To test if a value is one of these, compare your value to
|
||||
/// them directly, e.g:
|
||||
/// ```example
|
||||
/// #let val = none
|
||||
/// #if val == none [
|
||||
/// Yep, it's none.
|
||||
/// ]
|
||||
/// ```
|
||||
///
|
||||
/// Note that `type` will return [`content`] for all document elements. To
|
||||
/// programmatically determine which kind of content you are dealing with, see
|
||||
/// [`content.func`].
|
||||
#[ty(scope, cast)]
|
||||
#[derive(Copy, Clone, Eq, PartialEq, Hash)]
|
||||
pub struct Type(Static<NativeTypeData>);
|
||||
|
Loading…
x
Reference in New Issue
Block a user