Fix doctest
This commit is contained in:
parent
b42a12465a
commit
bf1b7ed39c
24
src/lib.rs
24
src/lib.rs
|
@ -94,13 +94,8 @@
|
||||||
pub mod physics;
|
pub mod physics;
|
||||||
pub mod vec2;
|
pub mod vec2;
|
||||||
|
|
||||||
use std::{
|
#[cfg(feature = "audio")]
|
||||||
cell::Cell,
|
use rodio::{self, source::Source, Decoder, OutputStream};
|
||||||
ops::{Deref, DerefMut},
|
|
||||||
path::Path,
|
|
||||||
slice::IterMut,
|
|
||||||
};
|
|
||||||
use std::{thread};
|
|
||||||
use sdl2::{
|
use sdl2::{
|
||||||
image::ImageRWops,
|
image::ImageRWops,
|
||||||
mouse::MouseButton,
|
mouse::MouseButton,
|
||||||
|
@ -114,8 +109,13 @@ use sdl2::{
|
||||||
};
|
};
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io::BufReader;
|
use std::io::BufReader;
|
||||||
#[cfg(feature = "audio")]
|
use std::thread;
|
||||||
use rodio::{self, Decoder, OutputStream, source::Source};
|
use std::{
|
||||||
|
cell::Cell,
|
||||||
|
ops::{Deref, DerefMut},
|
||||||
|
path::Path,
|
||||||
|
slice::IterMut,
|
||||||
|
};
|
||||||
use vec2::Vec2Int;
|
use vec2::Vec2Int;
|
||||||
|
|
||||||
#[doc(no_inline)]
|
#[doc(no_inline)]
|
||||||
|
@ -773,9 +773,11 @@ impl Game {
|
||||||
self.stopped.set(true);
|
self.stopped.set(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Plays an audio file given the path of file and plays it for y seconds
|
/// Plays an audio file given the path of file and plays it for y seconds
|
||||||
/// ```
|
/// ```no_run
|
||||||
/// play(String::from("/path/to/song.mp3", 15));
|
/// # use cat_box::play;
|
||||||
|
/// play("/path/to/song.mp3", 15);
|
||||||
/// ```
|
/// ```
|
||||||
#[cfg(feature = "audio")]
|
#[cfg(feature = "audio")]
|
||||||
pub fn play<P: AsRef<Path> + std::marker::Send + 'static>(x: P, y: u64) -> thread::JoinHandle<()> {
|
pub fn play<P: AsRef<Path> + std::marker::Send + 'static>(x: P, y: u64) -> thread::JoinHandle<()> {
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#![warn(clippy::pedantic)]
|
#![warn(clippy::pedantic)]
|
||||||
|
|
||||||
use cat_box::{draw_text, get_keyboard_state, get_mouse_state, Game, Sprite, SpriteCollection, play};
|
use cat_box::{
|
||||||
|
draw_text, get_keyboard_state, get_mouse_state, play, Game, Sprite, SpriteCollection,
|
||||||
|
};
|
||||||
use sdl2::keyboard::Scancode;
|
use sdl2::keyboard::Scancode;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
Loading…
Reference in a new issue