Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing some doc comments #9646

Merged
merged 11 commits into from
Aug 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions crates/bevy_animation/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ pub struct AnimationPlayer {
}

impl AnimationPlayer {
/// Start playing an animation, resetting state of the player
/// This will use a linear blending between the previous and the new animation to make a smooth transition
/// Start playing an animation, resetting state of the player.
/// This will use a linear blending between the previous and the new animation to make a smooth transition.
pub fn start(&mut self, handle: Handle<AnimationClip>) -> &mut Self {
self.animation = PlayingAnimation {
animation_clip: handle,
Expand All @@ -193,8 +193,8 @@ impl AnimationPlayer {
self
}

/// Start playing an animation, resetting state of the player
/// This will use a linear blending between the previous and the new animation to make a smooth transition
/// Start playing an animation, resetting state of the player.
/// This will use a linear blending between the previous and the new animation to make a smooth transition.
pub fn start_with_transition(
&mut self,
handle: Handle<AnimationClip>,
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_asset/src/assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ impl<T: Asset> Assets<T> {
/// Get mutable access to the asset for the given handle.
///
/// This is the main method for mutably accessing asset data from an [Assets] collection. If you
/// do not need mutable access to the asset, you may also use [get](Assets::get).
/// do not need mutable access to the asset, you may also use [`get`](Assets::get).
pub fn get_mut(&mut self, handle: &Handle<T>) -> Option<&mut T> {
let id: HandleId = handle.into();
self.events.send(AssetEvent::Modified {
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_audio/src/audio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ impl VolumeLevel {
}
}

/// How should Bevy manage the sound playback?
/// The way Bevy manages the sound playback.
#[derive(Debug, Clone, Copy)]
pub enum PlaybackMode {
/// Play the sound once. Do nothing when it ends.
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_audio/src/audio_source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ impl AssetLoader for AudioLoader {
/// in order to be registered.
/// Types that implement this trait usually contain raw sound data that can be converted into an iterator of samples.
/// This trait is implemented for [`AudioSource`].
/// Check the example `audio/decodable` for how to implement this trait on a custom type.
/// Check the example [`decodable`](https://github.com/bevyengine/bevy/blob/latest/examples/audio/decodable.rs) for how to implement this trait on a custom type.
pub trait Decodable: Send + Sync + 'static {
/// The type of the audio samples.
/// Usually a [`u16`], [`i16`] or [`f32`], as those implement [`rodio::Sample`].
Expand Down
11 changes: 4 additions & 7 deletions crates/bevy_transform/src/commands.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
//! Extension to [`EntityCommands`] to modify [`bevy_hierarchy`] hierarchies
//! Extension to [`EntityCommands`] to modify `bevy_hierarchy` hierarchies
//! while preserving [`GlobalTransform`].

use bevy_ecs::{prelude::Entity, system::Command, system::EntityCommands, world::World};
use bevy_hierarchy::{AddChild, RemoveParent};

#[cfg(doc)]
use bevy_hierarchy::BuildChildren;

Comment on lines -7 to -9
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove the doc import? I find it better than repeating multiple times the full path in-line.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The links were not working on my end.
See latest doc

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oooh I see. For this one, this is a correct change.

use crate::{GlobalTransform, Transform};

/// Command similar to [`AddChild`], but updating the child transform to keep
Expand Down Expand Up @@ -63,13 +60,13 @@ impl Command for RemoveParentInPlace {
update_transform();
}
}
/// Collection of methods similar to [`BuildChildren`], but preserving each
/// Collection of methods similar to [`BuildChildren`](bevy_hierarchy::BuildChildren), but preserving each
/// entity's [`GlobalTransform`].
pub trait BuildChildrenTransformExt {
/// Change this entity's parent while preserving this entity's [`GlobalTransform`]
/// by updating its [`Transform`].
///
/// See [`BuildChildren::set_parent`] for a method that doesn't update the
/// See [`BuildChildren::set_parent`](bevy_hierarchy::BuildChildren::set_parent) for a method that doesn't update the
/// [`Transform`].
///
/// Note that both the hierarchy and transform updates will only execute
Expand All @@ -80,7 +77,7 @@ pub trait BuildChildrenTransformExt {
/// Make this entity parentless while preserving this entity's [`GlobalTransform`]
/// by updating its [`Transform`] to be equal to its current [`GlobalTransform`].
///
/// See [`BuildChildren::remove_parent`] for a method that doesn't update the
/// See [`BuildChildren::remove_parent`](bevy_hierarchy::BuildChildren::remove_parent) for a method that doesn't update the
/// [`Transform`].
///
/// Note that both the hierarchy and transform updates will only execute
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_winit/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ use crate::web_resize::{CanvasParentResizeEventChannel, CanvasParentResizePlugin
#[cfg(target_os = "android")]
pub static ANDROID_APP: std::sync::OnceLock<AndroidApp> = std::sync::OnceLock::new();

/// A [`Plugin`] that uses [`winit`] to create and manage windows, and receive window and input
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove the crate-level links? I find them useful.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the docs the links are not displayed and look a bit weird in return.
Is this still wanted behavior?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They work on locally generated versions of the doc (by running cargo doc --open) which is generally more useful, since the search bar can search for docs on more than a single dependency.

But I'm OK with removing them if they don't works on docs.rs

/// A [`Plugin`] that uses `winit` to create and manage windows, and receive window and input
/// events.
///
/// This plugin will add systems and resources that sync with the [`winit`] backend and also
/// This plugin will add systems and resources that sync with the `winit` backend and also
/// replace the exising [`App`] runner with one that constructs an [event loop](EventLoop) to
/// receive window and input events from the OS.
#[derive(Default)]
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_winit/src/winit_windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use crate::{
converters::{convert_enabled_buttons, convert_window_level, convert_window_theme},
};

/// A resource mapping window entities to their [`winit`]-backend [`Window`](winit::window::Window)
/// A resource mapping window entities to their `winit`-backend [`Window`](winit::window::Window)
/// states.
#[derive(Debug, Default)]
pub struct WinitWindows {
Expand Down