File tree Expand file tree Collapse file tree 2 files changed +30
-2
lines changed Expand file tree Collapse file tree 2 files changed +30
-2
lines changed Original file line number Diff line number Diff line change 1
1
---
2
- refs/heads/master: 0d83956e2bd6b151ef662926e0f2181417b73f6d
2
+ refs/heads/master: 556de425b3824933c73e6e9badb74079341de7c8
Original file line number Diff line number Diff line change @@ -1757,12 +1757,19 @@ path required to refer to a module item.
1757
1757
dependencies are independently declared with @code {use }
1758
1758
declarations. @xref {Ref.Comp.Crate }.
1759
1759
1760
- An example of an import :
1760
+ An example of imports :
1761
1761
@example
1762
1762
import std::math::sin;
1763
+ import std::option::*;
1764
+ import std::str::@{ char_at, hash@} ;
1765
+
1763
1766
fn main() @{
1764
1767
// Equivalent to 'log std::math::sin(1.0);'
1765
1768
log sin(1.0);
1769
+ // Equivalent to 'log std::option::some(1.0);'
1770
+ log some(1.0);
1771
+ // Equivalent to 'log std::str::hash(std::str::char_at("foo"));'
1772
+ log hash(char_at("foo"));
1766
1773
@}
1767
1774
@end example
1768
1775
@@ -1800,6 +1807,27 @@ fn main() @{
1800
1807
@}
1801
1808
@end example
1802
1809
1810
+ Multiple items may be exported from a single export declaration:
1811
+
1812
+ @example
1813
+ mod foo @{
1814
+ export primary, secondary;
1815
+
1816
+ fn primary() @{
1817
+ helper(1, 2);
1818
+ helper(3, 4);
1819
+ @}
1820
+
1821
+ fn secondary() @{
1822
+ @dots {}
1823
+ @}
1824
+
1825
+ fn helper(x: int, y: int) @{
1826
+ @dots {}
1827
+ @}
1828
+ @}
1829
+ @end example
1830
+
1803
1831
1804
1832
@node Ref.Item.Fn
1805
1833
@subsection Ref.Item.Fn
You can’t perform that action at this time.
0 commit comments