Skip to content

Commit 179c9b2

Browse files
committed
docs: fix a collection of inconsistent function and trait documentation
1 parent 617ae30 commit 179c9b2

File tree

5 files changed

+28
-5
lines changed

5 files changed

+28
-5
lines changed

Cargo.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,15 @@ required-features = ["parallelism", "mzsignal", "nalgebra"]
3535
[[example]]
3636
name = "random_access_iter"
3737
required-features = ["nalgebra"]
38+
doc-scrape-examples = true
39+
40+
[[example]]
41+
name = "mzinfo"
42+
doc-scrape-examples = true
43+
44+
[[example]]
45+
name = "mzconvert"
46+
doc-scrape-examples = true
3847

3948
[lib]
4049
name = "mzdata"

src/io/mzml/reader.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,7 @@ impl<C: CentroidLike, D: DeconvolutedCentroidLike> Default for MzMLSpectrumBuild
440440
impl<C: CentroidLike, D: DeconvolutedCentroidLike> XMLParseBase for MzMLSpectrumBuilder<'_, C, D> {}
441441
impl<C: CentroidLike, D: DeconvolutedCentroidLike> CVParamParse for MzMLSpectrumBuilder<'_, C, D> {}
442442

443+
#[doc(hidden)]
443444
impl<'inner, C: CentroidLike, D: DeconvolutedCentroidLike>
444445
SpectrumBuilding<'inner, C, D, MultiLayerSpectrum<C, D>> for MzMLSpectrumBuilder<'inner, C, D>
445446
{
@@ -1086,6 +1087,7 @@ impl<C: CentroidLike + BuildFromArrayMap, D: DeconvolutedCentroidLike + BuildFro
10861087
}
10871088
}
10881089

1090+
#[doc(hidden)]
10891091
impl<'a, C: CentroidLike, D: DeconvolutedCentroidLike> From<MzMLSpectrumBuilder<'a, C, D>>
10901092
for CentroidSpectrumType<C>
10911093
where
@@ -1099,6 +1101,7 @@ where
10991101
}
11001102
}
11011103

1104+
#[doc(hidden)]
11021105
impl<'a, C: CentroidLike, D: DeconvolutedCentroidLike> From<MzMLSpectrumBuilder<'a, C, D>>
11031106
for MultiLayerSpectrum<C, D>
11041107
{
@@ -1109,6 +1112,7 @@ impl<'a, C: CentroidLike, D: DeconvolutedCentroidLike> From<MzMLSpectrumBuilder<
11091112
}
11101113
}
11111114

1115+
#[doc(hidden)]
11121116
impl<'a> From<MzMLSpectrumBuilder<'a>> for RawSpectrum {
11131117
fn from(val: MzMLSpectrumBuilder<'a>) -> Self {
11141118
let mut spec = Spectrum::default();

src/params.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1233,7 +1233,7 @@ macro_rules! find_param_method {
12331233
#[macro_export]
12341234
macro_rules! curie {
12351235
(MS:$acc:literal) => {
1236-
$crate::params::CURIE::new($crate::params::ControlledVocabulary::MS, $acc)
1236+
$crate::params::CURIE { controlled_vocabulary: $crate::params::ControlledVocabulary::MS, accession: $acc }
12371237
};
12381238
(UO:$acc:literal) => {
12391239
$crate::params::CURIE { controlled_vocabulary: $crate::params::ControlledVocabulary::UO, accession: $acc }

src/spectrum/chromatogram.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ pub trait ChromatogramLike: ParamDescribed {
160160
self.description().ms_level
161161
}
162162

163-
/// Access the native ID string for the spectrum
163+
/// Access the native ID string for the chromatogram
164164
#[inline]
165165
fn id(&self) -> &str {
166166
&self.description().id
@@ -171,7 +171,7 @@ pub trait ChromatogramLike: ParamDescribed {
171171
self.description().chromatogram_type
172172
}
173173

174-
/// Access the index of the spectrum in the source file
174+
/// Access the index of the chromatogram in the source file
175175
#[inline]
176176
fn index(&self) -> usize {
177177
self.description().index

src/spectrum/spectrum_types.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,6 +1137,7 @@ where
11371137
}
11381138
}
11391139

1140+
/// Construct a [`MultiLayerSpectrum`] with `description` and the provided raw data arrays
11401141
pub fn from_arrays_and_description(
11411142
arrays: BinaryArrayMap,
11421143
description: SpectrumDescription,
@@ -1148,6 +1149,7 @@ where
11481149
}
11491150
}
11501151

1152+
/// Construct a [`MultiLayerSpectrum`] with `description` and *no* peak data of any kind
11511153
pub fn from_description(description: SpectrumDescription) -> Self {
11521154
Self {
11531155
description,
@@ -1167,13 +1169,21 @@ where
11671169
}
11681170
}
11691171

1172+
/// Converts an arbitrary [`SpectrumLike`] type into a [`MultiLayerSpectrum`] with the same
1173+
/// peak types.
1174+
///
1175+
/// This is a thin wrapper around [`SpectrumLike::into_peaks_and_description`] and [`MultiLayerSpectrum::from_peaks_data_levels_and_description`]
11701176
pub fn from_spectrum_like<S: SpectrumLike<C, D>>(spectrum: S) -> Self {
11711177
let (peaks, description) = spectrum.into_peaks_and_description();
11721178
Self::from_peaks_data_levels_and_description(peaks, description)
11731179
}
11741180

1175-
/// Convert a [`DeconvolutedSpectrumType`] into a [`MultiLayerSpectrum`] over any peak type, but
1176-
/// recode the peak list as [`DataArray`], potentially losing information.
1181+
/// Convert a [`MultiLayerSpectrum`] with one set of peak types to another with any peak type, but
1182+
/// recode the peak list as [`DataArray`] as an intermediary, potentially losing information.
1183+
///
1184+
/// ## Note
1185+
/// Peak data is not actually reconstructed from the intermediate data arrays. If that is desired,
1186+
/// call [`MultiLayerSpectrum::try_build_peaks`]
11771187
pub fn reinterpret<C1, D1>(self) -> MultiLayerSpectrum<C1, D1>
11781188
where
11791189
C1: CentroidLike + BuildArrayMapFrom + BuildFromArrayMap,

0 commit comments

Comments
 (0)