File tree 1 file changed +7
-2
lines changed
1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -893,6 +893,9 @@ pub fn sleep(dur: Duration) {
893
893
/// # use std::time::{Duration, Instant};
894
894
/// # use std::thread;
895
895
/// #
896
+ /// # fn update() {}
897
+ /// # fn render() {}
898
+ /// #
896
899
/// let max_fps = 60.0;
897
900
/// let frame_time = Duration::from_secs_f32(1.0/max_fps);
898
901
/// let mut next_frame = Instant::now();
@@ -912,17 +915,19 @@ pub fn sleep(dur: Duration) {
912
915
/// # use std::time::{Duration, Instant};
913
916
/// # use std::thread;
914
917
/// #
918
+ /// # fn slow_web_api_call() {}
919
+ /// #
915
920
/// # const MAX_DURATION: Duration = Duration::from_secs(10);
916
921
/// #
917
922
/// let deadline = Instant::now() + MAX_DURATION;
918
923
/// let delay = Duration::from_millis(250);
919
924
/// let mut next_attempt = Instant::now();
920
925
/// loop {
921
926
/// if Instant::now() > deadline {
922
- /// break Err(()),
927
+ /// break Err(());
923
928
/// }
924
929
/// if let Ready(data) = slow_web_api_call() {
925
- /// break Ok(data),
930
+ /// break Ok(data);
926
931
/// }
927
932
///
928
933
/// next_attempt = deadline.min(next_attempt + delay);
You can’t perform that action at this time.
0 commit comments