From 7a22cf6415b75388448156708c07dd6cf5eb116a Mon Sep 17 00:00:00 2001 From: Ivan Tham Date: Mon, 13 Apr 2020 22:25:15 +0800 Subject: Add examples to Pattern docs --- src/liballoc/string.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/liballoc/string.rs') diff --git a/src/liballoc/string.rs b/src/liballoc/string.rs index cc628fe0f0c..86e09b7be2d 100644 --- a/src/liballoc/string.rs +++ b/src/liballoc/string.rs @@ -1828,6 +1828,12 @@ impl<'a> Extend> for String { } /// A convenience impl that delegates to the impl for `&str`. +/// +/// # Examples +/// +/// ``` +/// assert_eq!(String::from("Hello world").find("world"), Some(6)); +/// ``` #[unstable( feature = "pattern", reason = "API not fully fleshed out and ready to be stabilized", -- cgit 1.4.1-3-g733a5