Generalize copy and clone impls for generic structs

This commit is contained in:
David Tolnay 2022-07-08 16:58:22 -07:00
parent 519b4c166f
commit 1c25bb200a
No known key found for this signature in database
GPG key ID: F9BA143B95FF6D82

View file

@ -1054,7 +1054,6 @@ pub(crate) struct yaml_string_t {
pub pointer: *mut yaml_char_t,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub(crate) struct yaml_buffer_t<T> {
/// The beginning of the buffer.
@ -1067,7 +1066,13 @@ pub(crate) struct yaml_buffer_t<T> {
pub last: *mut T,
}
#[derive(Copy, Clone)]
impl<T> Copy for yaml_buffer_t<T> {}
impl<T> Clone for yaml_buffer_t<T> {
fn clone(&self) -> Self {
*self
}
}
#[repr(C)]
pub struct yaml_stack_t<T> {
/// The beginning of the stack.
@ -1078,7 +1083,13 @@ pub struct yaml_stack_t<T> {
pub top: *mut T,
}
#[derive(Copy, Clone)]
impl<T> Copy for yaml_stack_t<T> {}
impl<T> Clone for yaml_stack_t<T> {
fn clone(&self) -> Self {
*self
}
}
#[repr(C)]
pub(crate) struct yaml_queue_t<T> {
/// The beginning of the queue.
@ -1090,3 +1101,10 @@ pub(crate) struct yaml_queue_t<T> {
/// The tail of the queue.
pub tail: *mut T,
}
impl<T> Copy for yaml_queue_t<T> {}
impl<T> Clone for yaml_queue_t<T> {
fn clone(&self) -> Self {
*self
}
}