Skip to content

Commit

Permalink
epaint: add some missing inline docs (emilk#4815)
Browse files Browse the repository at this point in the history
Document a few `Mesh` methods.
  • Loading branch information
WojciechMula authored and hacknus committed Oct 30, 2024
1 parent 86996ec commit abc94b6
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions crates/epaint/src/mesh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ impl Mesh {
self.vertices = Default::default();
}

/// Returns the amount of memory used by the vertices and indices.
pub fn bytes_used(&self) -> usize {
std::mem::size_of::<Self>()
+ self.vertices.len() * std::mem::size_of::<Vertex>()
Expand Down Expand Up @@ -107,6 +108,8 @@ impl Mesh {
}

/// Append all the indices and vertices of `other` to `self`.
///
/// Panics when `other` mesh has a different texture.
pub fn append(&mut self, other: Self) {
crate::profile_function!();
debug_assert!(other.is_valid());
Expand All @@ -120,6 +123,8 @@ impl Mesh {

/// Append all the indices and vertices of `other` to `self` without
/// taking ownership.
///
/// Panics when `other` mesh has a different texture.
pub fn append_ref(&mut self, other: &Self) {
debug_assert!(other.is_valid());

Expand All @@ -138,6 +143,9 @@ impl Mesh {
self.vertices.extend(other.vertices.iter());
}

/// Add a colored vertex.
///
/// Panics when the mesh has assigned a texture.
#[inline(always)]
pub fn colored_vertex(&mut self, pos: Pos2, color: Color32) {
debug_assert!(self.texture_id == TextureId::default());
Expand Down

0 comments on commit abc94b6

Please sign in to comment.