Skip to content

Commit

Permalink
fmt docs code
Browse files Browse the repository at this point in the history
  • Loading branch information
ezpuzz committed Jan 19, 2021
1 parent dcaca9f commit ac89cd5
Show file tree
Hide file tree
Showing 20 changed files with 78 additions and 67 deletions.
1 change: 0 additions & 1 deletion amethyst_assets/src/asset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ pub trait Format<D: 'static>: objekt::Clone + Send + Sync + 'static {
///
/// If you are implementing `format` yourself, this method will never be used
/// and can be left unimplemented.
///
fn import_simple(&self, _bytes: Vec<u8>) -> Result<D, Error> {
unimplemented!("You must implement either `import_simple` or `import`.")
}
Expand Down
1 change: 0 additions & 1 deletion amethyst_audio/src/source.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//! Provides structures used to load audio files.
//!
use amethyst_assets::{Asset, AssetStorage, Handle, LoadHandle, ProcessableAsset, ProcessingState};
use amethyst_error::Error;
use type_uuid::TypeUuid;
Expand Down
3 changes: 2 additions & 1 deletion amethyst_core/src/logger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ impl Default for LoggerConfig {
/// target = record.target(),
/// message = message,
/// ))
/// }).start();
/// })
/// .start();
/// ```
#[allow(missing_debug_implementations)]
pub struct Logger {
Expand Down
2 changes: 1 addition & 1 deletion amethyst_core/src/named.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ use serde::{Deserialize, Serialize};
/// world.push((Named { name: format!("Entity Number {}", entity_num).into() },));
/// }
/// ```
///
///
/// Accessing a named entity in a system:
/// ```
/// use amethyst::core::Named;
Expand Down
32 changes: 17 additions & 15 deletions amethyst_core/src/system_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,31 +25,33 @@ use legion::{
///
/// # Examples
/// ```rust
/// use legion::{system, Schedule, World, Resources, SystemBuilder};
/// use amethyst_core::system_ext::pausable;
/// use amethyst_core::ecs::{System, ParallelRunnable};
/// use amethyst_core::dispatcher::DispatcherBuilder;
/// use amethyst_core::{
/// dispatcher::DispatcherBuilder,
/// ecs::{ParallelRunnable, System},
/// system_ext::pausable,
/// };
/// use legion::{system, Resources, Schedule, SystemBuilder, World};
///
/// #[derive(PartialEq)]
/// enum CurrentState {
/// Disabled,
/// Enabled,
/// }
///
///
/// struct TestSystem;
///
/// impl System<'_> for TestSystem{
/// impl System<'_> for TestSystem {
/// fn build(&mut self) -> Box<dyn ParallelRunnable> {
/// Box::new(
/// pausable(SystemBuilder::new("TestSystem")
/// .write_resource::<u32>()
/// .build(move |_commands, _world, resources, _| {
/// **resources += 1;
/// }),
/// CurrentState::Enabled
/// ))
/// }}
/// Box::new(pausable(
/// SystemBuilder::new("TestSystem")
/// .write_resource::<u32>()
/// .build(move |_commands, _world, resources, _| {
/// **resources += 1;
/// }),
/// CurrentState::Enabled,
/// ))
/// }
/// }
///
/// let mut dispatcher = DispatcherBuilder::default()
/// .add_system(Box::new(TestSystem))
Expand Down
9 changes: 3 additions & 6 deletions amethyst_core/src/transform/components/transform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,13 @@ impl Transform {
/// // No rotation by default
/// assert_eq!(*t.rotation().quaternion(), Quaternion::identity());
/// // look up with up pointing backwards
/// t.face_towards(
/// Vector3::new(0.0, 1.0, 0.0),
/// Vector3::new(0.0, 0.0, 1.0),
/// );
/// t.face_towards(Vector3::new(0.0, 1.0, 0.0), Vector3::new(0.0, 0.0, 1.0));
/// // our rotation should match the angle from straight ahead to straight up
/// let rotation = UnitQuaternion::rotation_between(
/// &Vector3::new(0.0, 1.0, 0.0),
/// &Vector3::new(0.0, 0.0, 1.0),
/// ).unwrap();
/// )
/// .unwrap();
/// assert_eq!(*t.rotation(), rotation);
/// // now if we move forwards by 1.0, we'll end up at the point we are facing
/// // (modulo some floating point error)
Expand Down Expand Up @@ -617,7 +615,6 @@ impl From<Vector3<f32>> for Transform {
/// # use amethyst_core::math::Vector3;
/// let transform = Transform::from(Vector3::new(100.0, 200.0, 300.0));
/// assert_eq!(transform.translation().x, 100.0);
///
impl From<Vector3<f64>> for Transform {
#[inline]
fn from(translation: Vector3<f64>) -> Self {
Expand Down
6 changes: 4 additions & 2 deletions amethyst_error/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,10 @@ impl Error {
/// [`with_context`](trait.ResultExt.html#method.with_context).
///
/// ```rust
/// use amethyst_error::{Error, ResultExt};
/// use std::io;
///
/// use amethyst_error::{Error, ResultExt};
///
/// let e = io::Error::new(io::ErrorKind::Other, "wrapped");
/// let a = Error::new(e);
///
Expand Down Expand Up @@ -281,7 +282,8 @@ impl<'a> Iterator for Causes<'a> {
/// Constructs an `Error` using the standard string interpolation syntax.
///
/// ```rust
/// #[macro_use] extern crate amethyst_error;
/// #[macro_use]
/// extern crate amethyst_error;
///
/// fn main() {
/// let err = format_err!("number: {}", 42);
Expand Down
1 change: 0 additions & 1 deletion amethyst_input/src/bundle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ use crate::{BindingError, Bindings, InputHandler, InputSystem};
/// ## Errors
///
/// No errors returned from this bundle.
///
#[derive(Debug, Default)]
pub struct InputBundle {
bindings: Option<Bindings>,
Expand Down
2 changes: 1 addition & 1 deletion amethyst_rendy/src/formats/texture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use crate::types::TextureData;
///
/// # Example Usage
/// ```ignore
///
///
/// let loader = res.fetch_mut::<DefaultLoader>();
/// let texture_storage = res.fetch_mut::<AssetStorage<Texture>>();
///
Expand Down
18 changes: 12 additions & 6 deletions amethyst_rendy/src/plugins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,20 +65,26 @@ mod window {
/// This function takes linear RGBA. You can convert rgba to linear rgba like so:
///
/// ```
/// use amethyst_rendy::palette::Srgba;
/// use amethyst_rendy::{RenderToWindow, rendy::hal::command::ClearColor};
/// use amethyst_rendy::{palette::Srgba, rendy::hal::command::ClearColor, RenderToWindow};
/// use amethyst_window::DisplayConfig;
///
/// let your_red: f32 = 255.;
/// let your_green: f32 = 160.;
/// let your_blue: f32 = 122.;
/// let your_alpha: f32 = 1.0;
///
/// let (r, g, b, a) = Srgba::new(your_red / 255., your_green / 255., your_blue / 255., your_alpha)
/// .into_linear()
/// .into_components();
/// let (r, g, b, a) = Srgba::new(
/// your_red / 255.,
/// your_green / 255.,
/// your_blue / 255.,
/// your_alpha,
/// )
/// .into_linear()
/// .into_components();
///
/// RenderToWindow::from_config(DisplayConfig::default()).with_clear(ClearColor { float32: [r, g, b, a] });
/// RenderToWindow::from_config(DisplayConfig::default()).with_clear(ClearColor {
/// float32: [r, g, b, a],
/// });
/// ```
pub fn with_clear(mut self, clear: impl Into<ClearColor>) -> Self {
self.clear = Some(clear.into());
Expand Down
1 change: 0 additions & 1 deletion amethyst_rendy/src/resources.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//! `amethyst` rendering ecs resources
//!
/// The ambient color of a scene
#[derive(Clone, Debug, Default, serde::Serialize, serde::Deserialize)]
Expand Down
10 changes: 2 additions & 8 deletions amethyst_rendy/src/serde_shim.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ use serde::{Deserialize, Deserializer, Serialize, Serializer};
/// ```
/// # use serde::{Serialize, Deserialize};
/// #[derive(Serialize, Deserialize)]
/// struct MyType(
/// #[serde(with="amethyst_rendy::serde_shim::srgb")]
/// pub palette::Srgb
/// );
/// struct MyType(#[serde(with = "amethyst_rendy::serde_shim::srgb")] pub palette::Srgb);
/// ```
pub mod srgb {
use super::*;
Expand All @@ -36,10 +33,7 @@ pub mod srgb {
/// ```
/// # use serde::{Serialize, Deserialize};
/// #[derive(Serialize, Deserialize)]
/// struct MyType(
/// #[serde(with="amethyst_rendy::serde_shim::srgba")]
/// pub palette::Srgba
/// );
/// struct MyType(#[serde(with = "amethyst_rendy::serde_shim::srgba")] pub palette::Srgba);
/// ```
pub mod srgba {
use super::*;
Expand Down
2 changes: 1 addition & 1 deletion amethyst_rendy/src/sprite/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ use amethyst_assets::{
/// ),
/// ],
/// ))
///}
/// }
/// ```
///
/// Such a spritesheet description can be loaded using a `Loader` by passing it the handle of the corresponding loaded texture.
Expand Down
1 change: 0 additions & 1 deletion amethyst_tiles/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//! 2D/3D Tile data structures and functionality.
//!
#![doc(
html_logo_url = "https://amethyst.rs/brand/logo-standard.svg",
Expand Down
6 changes: 3 additions & 3 deletions amethyst_ui/src/bundle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ use crate::{
///
/// Will fail with error 'No resource with the given id' if either the InputBundle or TransformBundle are not added.
#[derive(new, Debug, Default)]
pub struct UiBundle</*C = NoCustomUi, */ W = u32, G = ()> {
pub struct UiBundle</* C = NoCustomUi, */ W = u32, G = ()> {
#[new(default)]
_marker: PhantomData<(/*C,*/ W, G)>,
_marker: PhantomData<(/* C, */ W, G)>,
}

impl</*C,*/ W, G> SystemBundle for UiBundle</*C,*/ W, G>
impl</* C, */ W, G> SystemBundle for UiBundle</* C, */ W, G>
where
//C: ToNativeWidget,
W: WidgetId,
Expand Down
11 changes: 8 additions & 3 deletions amethyst_ui/src/image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,14 @@ pub enum UiImage {
/// let your_blue: f32 = 122.;
/// let your_alpha: f32 = 1.0;
///
/// let (r, g, b, a) = Srgba::new(your_red / 255., your_green / 255., your_blue / 255., your_alpha)
/// .into_linear()
/// .into_components();
/// let (r, g, b, a) = Srgba::new(
/// your_red / 255.,
/// your_green / 255.,
/// your_blue / 255.,
/// your_alpha,
/// )
/// .into_linear()
/// .into_components();
///
/// UiImage::SolidColor([r, g, b, a]);
/// ```
Expand Down
16 changes: 13 additions & 3 deletions amethyst_utils/src/removal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,21 @@ use serde::{Deserialize, Serialize};
/// Something2,
/// }
///
/// let _entity1 = world.create_entity().with(Removal::new(RemovalId::Something)).build();
/// let _entity2 = world.create_entity().with(Removal::new(RemovalId::Something2)).build();
/// let _entity1 = world
/// .create_entity()
/// .with(Removal::new(RemovalId::Something))
/// .build();
/// let _entity2 = world
/// .create_entity()
/// .with(Removal::new(RemovalId::Something2))
/// .build();
///
/// // Remove all entities with the RemovalId value of Something.
/// exec_removal(&world.entities(), &world.read_storage(), RemovalId::Something);
/// exec_removal(
/// &world.entities(),
/// &world.read_storage(),
/// RemovalId::Something,
/// );
///
/// // Force the world to be up to date. This is normally called automatically at the end of the
/// // frame by amethyst.
Expand Down
1 change: 0 additions & 1 deletion examples/mouse_raycast/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
//! Demonstrates how to perform raycasts with the camera to project from mouse to world coordinates.
//!
//!
use amethyst::{
assets::{
Expand Down
3 changes: 1 addition & 2 deletions rustfmt.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@ reorder_imports = true
merge_imports = true
group_imports = "StdExternalCrate"
force_multiline_blocks = true
# Consider the following after the legion port
#format_code_in_doc_comments = true
format_code_in_doc_comments = true
19 changes: 10 additions & 9 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,10 @@ where
/// you've created your `CoreApplication` instance:
///
/// ```
/// use amethyst::prelude::*;
/// use amethyst::core::transform::{Parent, Transform};
///
/// use amethyst::{
/// core::transform::{Parent, Transform},
/// prelude::*,
/// };
/// use log::{info, warn};
///
/// struct NullState;
Expand All @@ -88,8 +89,7 @@ where
///
/// // Build the application instance to initialize the default logger.
/// let assets_dir = "assets/";
/// let game = Application::build(assets_dir, NullState)?
/// .build(())?;
/// let game = Application::build(assets_dir, NullState)?.build(())?;
///
/// // Now logging can be performed as normal.
/// info!("Using the default logger provided by amethyst");
Expand All @@ -103,8 +103,10 @@ where
/// [log], and it will be used instead of the default logger:
///
/// ```
/// use amethyst::prelude::*;
/// use amethyst::core::transform::{Parent, Transform};
/// use amethyst::{
/// core::transform::{Parent, Transform},
/// prelude::*,
/// };
///
/// struct NullState;
/// impl EmptyState for NullState {}
Expand All @@ -117,8 +119,7 @@ where
/// // The default logger will be automatically disabled and any logging amethyst does
/// // will go through your custom logger.
/// let assets_dir = "assets/";
/// let game = Application::build(assets_dir, NullState)?
/// .build(())?;
/// let game = Application::build(assets_dir, NullState)?.build(())?;
///
/// Ok(())
/// }
Expand Down

0 comments on commit ac89cd5

Please sign in to comment.