Skip to content

Replacing (C-not exported) in the docs #2110

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

Merged
merged 1 commit into from
Mar 27, 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
6 changes: 3 additions & 3 deletions lightning-background-processor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ where U::Target: UtxoLookup, L::Target: Logger {
}
}

/// (C-not exported) as the bindings concretize everything and have constructors for us
/// This is not exported to bindings users as the bindings concretize everything and have constructors for us
impl<P: Deref<Target = P2PGossipSync<G, U, L>>, G: Deref<Target = NetworkGraph<L>>, U: Deref, L: Deref>
GossipSync<P, &RapidGossipSync<G, L>, G, U, L>
where
Expand All @@ -177,7 +177,7 @@ where
}
}

/// (C-not exported) as the bindings concretize everything and have constructors for us
/// This is not exported to bindings users as the bindings concretize everything and have constructors for us
impl<'a, R: Deref<Target = RapidGossipSync<G, L>>, G: Deref<Target = NetworkGraph<L>>, L: Deref>
GossipSync<
&P2PGossipSync<G, &'a (dyn UtxoLookup + Send + Sync), L>,
Expand All @@ -195,7 +195,7 @@ where
}
}

/// (C-not exported) as the bindings concretize everything and have constructors for us
/// This is not exported to bindings users as the bindings concretize everything and have constructors for us
impl<'a, L: Deref>
GossipSync<
&P2PGossipSync<&'a NetworkGraph<L>, &'a (dyn UtxoLookup + Send + Sync), L>,
Expand Down
26 changes: 13 additions & 13 deletions lightning-invoice/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ pub const DEFAULT_MIN_FINAL_CLTV_EXPIRY_DELTA: u64 = 18;
/// * `H`: exactly one `PaymentHash`
/// * `T`: the timestamp is set
///
/// (C-not exported) as we likely need to manually select one set of boolean type parameters.
/// This is not exported to bindings users as we likely need to manually select one set of boolean type parameters.
#[derive(Eq, PartialEq, Debug, Clone)]
pub struct InvoiceBuilder<D: tb::Bool, H: tb::Bool, T: tb::Bool, C: tb::Bool, S: tb::Bool> {
currency: Currency,
Expand Down Expand Up @@ -247,7 +247,7 @@ pub struct Invoice {
/// Represents the description of an invoice which has to be either a directly included string or
/// a hash of a description provided out of band.
///
/// (C-not exported) As we don't have a good way to map the reference lifetimes making this
/// This is not exported to bindings users as we don't have a good way to map the reference lifetimes making this
/// practically impossible to use safely in languages like C.
#[derive(Eq, PartialEq, Debug, Clone)]
pub enum InvoiceDescription<'f> {
Expand Down Expand Up @@ -297,7 +297,7 @@ pub struct RawInvoice {

/// Data of the `RawInvoice` that is encoded in the human readable part
///
/// (C-not exported) As we don't yet support `Option<Enum>`
/// This is not exported to bindings users as we don't yet support `Option<Enum>`
#[derive(Eq, PartialEq, Debug, Clone, Hash)]
pub struct RawHrp {
/// The currency deferred from the 3rd and 4th character of the bech32 transaction
Expand Down Expand Up @@ -357,7 +357,7 @@ impl SiPrefix {
/// Returns all enum variants of `SiPrefix` sorted in descending order of their associated
/// multiplier.
///
/// (C-not exported) As we don't yet support a slice of enums, and also because this function
/// This is not exported to bindings users as we don't yet support a slice of enums, and also because this function
/// isn't the most critical to expose.
pub fn values_desc() -> &'static [SiPrefix] {
use crate::SiPrefix::*;
Expand Down Expand Up @@ -387,7 +387,7 @@ pub enum Currency {

/// Tagged field which may have an unknown tag
///
/// (C-not exported) as we don't currently support TaggedField
/// This is not exported to bindings users as we don't currently support TaggedField
#[derive(Clone, Debug, Hash, Eq, PartialEq)]
pub enum RawTaggedField {
/// Parsed tagged field with known tag
Expand All @@ -400,7 +400,7 @@ pub enum RawTaggedField {
///
/// For descriptions of the enum values please refer to the enclosed type's docs.
///
/// (C-not exported) As we don't yet support enum variants with the same name the struct contained
/// This is not exported to bindings users as we don't yet support enum variants with the same name the struct contained
/// in the variant.
#[allow(missing_docs)]
#[derive(Clone, Debug, Hash, Eq, PartialEq)]
Expand All @@ -419,7 +419,7 @@ pub enum TaggedField {

/// SHA-256 hash
#[derive(Clone, Debug, Hash, Eq, PartialEq)]
pub struct Sha256(/// (C-not exported) as the native hash types are not currently mapped
pub struct Sha256(/// This is not exported to bindings users as the native hash types are not currently mapped
pub sha256::Hash);

/// Description string
Expand Down Expand Up @@ -873,7 +873,7 @@ impl RawInvoice {
/// of type `E`. Since the signature of a `SignedRawInvoice` is not required to be valid there
/// are no constraints regarding the validity of the produced signature.
///
/// (C-not exported) As we don't currently support passing function pointers into methods
/// This is not exported to bindings users as we don't currently support passing function pointers into methods
/// explicitly.
pub fn sign<F, E>(self, sign_method: F) -> Result<SignedRawInvoice, E>
where F: FnOnce(&Message) -> Result<RecoverableSignature, E>
Expand All @@ -892,7 +892,7 @@ impl RawInvoice {

/// Returns an iterator over all tagged fields with known semantics.
///
/// (C-not exported) As there is not yet a manual mapping for a FilterMap
/// This is not exported to bindings users as there is not yet a manual mapping for a FilterMap
pub fn known_tagged_fields(&self)
-> FilterMap<Iter<RawTaggedField>, fn(&RawTaggedField) -> Option<&TaggedField>>
{
Expand Down Expand Up @@ -941,7 +941,7 @@ impl RawInvoice {
find_extract!(self.known_tagged_fields(), TaggedField::Features(ref x), x)
}

/// (C-not exported) as we don't support Vec<&NonOpaqueType>
/// This is not exported to bindings users as we don't support Vec<&NonOpaqueType>
pub fn fallbacks(&self) -> Vec<&Fallback> {
find_all_extract!(self.known_tagged_fields(), TaggedField::Fallback(ref x), x).collect()
}
Expand Down Expand Up @@ -1170,7 +1170,7 @@ impl Invoice {

/// Returns an iterator over all tagged fields of this Invoice.
///
/// (C-not exported) As there is not yet a manual mapping for a FilterMap
/// This is not exported to bindings users as there is not yet a manual mapping for a FilterMap
pub fn tagged_fields(&self)
-> FilterMap<Iter<RawTaggedField>, fn(&RawTaggedField) -> Option<&TaggedField>> {
self.signed_invoice.raw_invoice().known_tagged_fields()
Expand All @@ -1183,7 +1183,7 @@ impl Invoice {

/// Return the description or a hash of it for longer ones
///
/// (C-not exported) because we don't yet export InvoiceDescription
/// This is not exported to bindings users because we don't yet export InvoiceDescription
pub fn description(&self) -> InvoiceDescription {
if let Some(direct) = self.signed_invoice.description() {
return InvoiceDescription::Direct(direct);
Expand Down Expand Up @@ -1253,7 +1253,7 @@ impl Invoice {

/// Returns a list of all fallback addresses
///
/// (C-not exported) as we don't support Vec<&NonOpaqueType>
/// This is not exported to bindings users as we don't support Vec<&NonOpaqueType>
pub fn fallbacks(&self) -> Vec<&Fallback> {
self.signed_invoice.fallbacks()
}
Expand Down
2 changes: 1 addition & 1 deletion lightning-invoice/src/ser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ impl Display for SignedRawInvoice {
}
}

/// (C-not exported)
/// This is not exported to bindings users
impl Display for RawHrp {
fn fmt(&self, f: &mut Formatter) -> Result<(), fmt::Error> {
let amount = match self.raw_amount {
Expand Down
2 changes: 1 addition & 1 deletion lightning-rapid-gossip-sync/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ impl<NG: Deref<Target=NetworkGraph<L>>, L: Deref> RapidGossipSync<NG, L> where L
/// Gets a reference to the underlying [`NetworkGraph`] which was provided in
/// [`RapidGossipSync::new`].
///
/// (C-not exported) as bindings don't support a reference-to-a-reference yet
/// This is not exported to bindings users as bindings don't support a reference-to-a-reference yet
pub fn network_graph(&self) -> &NG {
&self.network_graph
}
Expand Down
2 changes: 1 addition & 1 deletion lightning/src/chain/keysinterface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ use crate::util::invoice::construct_invoice_preimage;
/// Used as initial key material, to be expanded into multiple secret keys (but not to be used
/// directly). This is used within LDK to encrypt/decrypt inbound payment data.
///
/// (C-not exported) as we just use `[u8; 32]` directly
/// This is not exported to bindings users as we just use `[u8; 32]` directly
#[derive(Hash, Copy, Clone, PartialEq, Eq, Debug)]
pub struct KeyMaterial(pub [u8; 32]);

Expand Down
4 changes: 3 additions & 1 deletion lightning/src/chain/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ impl OutPoint {
}

/// Converts this OutPoint into the OutPoint field as used by rust-bitcoin
/// (C-not exported) as the same type is used universally in the C bindings for all outpoints
///
/// This is not exported to bindings users as the same type is used universally in the C bindings
/// for all outpoints
pub fn into_bitcoin_outpoint(self) -> BitcoinOutPoint {
BitcoinOutPoint {
txid: self.txid,
Expand Down
6 changes: 3 additions & 3 deletions lightning/src/ln/chan_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1272,7 +1272,7 @@ impl CommitmentTransaction {
///
/// Only include HTLCs that are above the dust limit for the channel.
///
/// (C-not exported) due to the generic though we likely should expose a version without
/// This is not exported to bindings users due to the generic though we likely should expose a version without
pub fn new_with_auxiliary_htlc_data<T>(commitment_number: u64, to_broadcaster_value_sat: u64, to_countersignatory_value_sat: u64, opt_anchors: bool, broadcaster_funding_key: PublicKey, countersignatory_funding_key: PublicKey, keys: TxCreationKeys, feerate_per_kw: u32, htlcs_with_aux: &mut Vec<(HTLCOutputInCommitment, T)>, channel_parameters: &DirectedChannelTransactionParameters) -> CommitmentTransaction {
// Sort outputs and populate output indices while keeping track of the auxiliary data
let (outputs, htlcs) = Self::internal_build_outputs(&keys, to_broadcaster_value_sat, to_countersignatory_value_sat, htlcs_with_aux, channel_parameters, opt_anchors, &broadcaster_funding_key, &countersignatory_funding_key).unwrap();
Expand All @@ -1298,7 +1298,7 @@ impl CommitmentTransaction {

/// Use non-zero fee anchors
///
/// (C-not exported) due to move, and also not likely to be useful for binding users
/// This is not exported to bindings users due to move, and also not likely to be useful for binding users
pub fn with_non_zero_fee_anchors(mut self) -> Self {
self.opt_non_zero_fee_anchors = Some(());
self
Expand Down Expand Up @@ -1479,7 +1479,7 @@ impl CommitmentTransaction {
/// which were included in this commitment transaction in output order.
/// The transaction index is always populated.
///
/// (C-not exported) as we cannot currently convert Vec references to/from C, though we should
/// This is not exported to bindings users as we cannot currently convert Vec references to/from C, though we should
/// expose a less effecient version which creates a Vec of references in the future.
pub fn htlcs(&self) -> &Vec<HTLCOutputInCommitment> {
&self.htlcs
Expand Down
12 changes: 7 additions & 5 deletions lightning/src/ln/channelmanager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,8 @@ struct ClaimableHTLC {
}

/// A payment identifier used to uniquely identify a payment to LDK.
/// (C-not exported) as we just use [u8; 32] directly
///
/// This is not exported to bindings users as we just use [u8; 32] directly
#[derive(Hash, Copy, Clone, PartialEq, Eq, Debug)]
pub struct PaymentId(pub [u8; 32]);

Expand All @@ -216,7 +217,8 @@ impl Readable for PaymentId {
}

/// An identifier used to uniquely identify an intercepted HTLC to LDK.
/// (C-not exported) as we just use [u8; 32] directly
///
/// This is not exported to bindings users as we just use [u8; 32] directly
#[derive(Hash, Copy, Clone, PartialEq, Eq, Debug)]
pub struct InterceptId(pub [u8; 32]);

Expand Down Expand Up @@ -568,7 +570,7 @@ struct PendingInboundPayment {
/// or, respectively, [`Router`] for its router, but this type alias chooses the concrete types
/// of [`KeysManager`] and [`DefaultRouter`].
///
/// (C-not exported) as Arcs don't make sense in bindings
/// This is not exported to bindings users as Arcs don't make sense in bindings
pub type SimpleArcChannelManager<M, T, F, L> = ChannelManager<
Arc<M>,
Arc<T>,
Expand All @@ -594,7 +596,7 @@ pub type SimpleArcChannelManager<M, T, F, L> = ChannelManager<
/// or, respectively, [`Router`] for its router, but this type alias chooses the concrete types
/// of [`KeysManager`] and [`DefaultRouter`].
///
/// (C-not exported) as Arcs don't make sense in bindings
/// This is not exported to bindings users as Arcs don't make sense in bindings
pub type SimpleRefChannelManager<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, M, T, F, L> = ChannelManager<&'a M, &'b T, &'c KeysManager, &'c KeysManager, &'c KeysManager, &'d F, &'e DefaultRouter<&'f NetworkGraph<&'g L>, &'g L, &'h Mutex<ProbabilisticScorer<&'f NetworkGraph<&'g L>, &'g L>>>, &'g L>;

/// Manager which keeps track of a number of channels and sends messages to the appropriate
Expand Down Expand Up @@ -7235,7 +7237,7 @@ where
/// In such cases the latest local transactions will be sent to the tx_broadcaster included in
/// this struct.
///
/// (C-not exported) because we have no HashMap bindings
/// This is not exported to bindings users because we have no HashMap bindings
pub channel_monitors: HashMap<OutPoint, &'a mut ChannelMonitor<<SP::Target as SignerProvider>::Signer>>,
}

Expand Down
5 changes: 3 additions & 2 deletions lightning/src/ln/features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ mod sealed {
/// Tracks the set of features which a node implements, templated by the context in which it
/// appears.
///
/// (C-not exported) as we map the concrete feature types below directly instead
/// This is not exported to bindings users as we map the concrete feature types below directly instead
#[derive(Eq)]
pub struct Features<T: sealed::Context> {
/// Note that, for convenience, flags is LITTLE endian (despite being big-endian on the wire)
Expand Down Expand Up @@ -622,7 +622,8 @@ impl<T: sealed::Context> Features<T> {

/// Create a Features given a set of flags, in little-endian. This is in reverse byte order from
/// most on-the-wire encodings.
/// (C-not exported) as we don't support export across multiple T
///
/// This is not exported to bindings users as we don't support export across multiple T
pub fn from_le_bytes(flags: Vec<u8>) -> Features<T> {
Features {
flags,
Expand Down
9 changes: 6 additions & 3 deletions lightning/src/ln/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,18 @@ mod shutdown_tests;
pub use self::peer_channel_encryptor::LN_MAX_MSG_LEN;

/// payment_hash type, use to cross-lock hop
/// (C-not exported) as we just use [u8; 32] directly
///
/// This is not exported to bindings users as we just use [u8; 32] directly
#[derive(Hash, Copy, Clone, PartialEq, Eq, Debug)]
pub struct PaymentHash(pub [u8; 32]);
/// payment_preimage type, use to route payment between hop
/// (C-not exported) as we just use [u8; 32] directly
///
/// This is not exported to bindings users as we just use [u8; 32] directly
#[derive(Hash, Copy, Clone, PartialEq, Eq, Debug)]
pub struct PaymentPreimage(pub [u8; 32]);
/// payment_secret type, use to authenticate sender to the receiver and tie MPP HTLCs together
/// (C-not exported) as we just use [u8; 32] directly
///
/// This is not exported to bindings users as we just use [u8; 32] directly
#[derive(Hash, Copy, Clone, PartialEq, Eq, Debug)]
pub struct PaymentSecret(pub [u8; 32]);

Expand Down
2 changes: 1 addition & 1 deletion lightning/src/ln/msgs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -939,7 +939,7 @@ pub struct CommitmentUpdate {
/// [`OptionalField`] simply gets `Present` if there are enough bytes to read into it), we have a
/// separate enum type for them.
///
/// (C-not exported) due to a free generic in `T`
/// This is not exported to bindings users due to a free generic in `T`
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum OptionalField<T> {
/// Optional field is included in message
Expand Down
8 changes: 4 additions & 4 deletions lightning/src/ln/peer_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ impl Peer {
/// SimpleRefPeerManager is the more appropriate type. Defining these type aliases prevents
/// issues such as overly long function definitions.
///
/// (C-not exported) as `Arc`s don't make sense in bindings.
/// This is not exported to bindings users as `Arc`s don't make sense in bindings.
pub type SimpleArcPeerManager<SD, M, T, F, C, L> = PeerManager<SD, Arc<SimpleArcChannelManager<M, T, F, L>>, Arc<P2PGossipSync<Arc<NetworkGraph<Arc<L>>>, Arc<C>, Arc<L>>>, Arc<SimpleArcOnionMessenger<L>>, Arc<L>, IgnoringMessageHandler, Arc<KeysManager>>;

/// SimpleRefPeerManager is a type alias for a PeerManager reference, and is the reference
Expand All @@ -532,7 +532,7 @@ pub type SimpleArcPeerManager<SD, M, T, F, C, L> = PeerManager<SD, Arc<SimpleArc
/// But if this is not necessary, using a reference is more efficient. Defining these type aliases
/// helps with issues such as long function definitions.
///
/// (C-not exported) as general type aliases don't make sense in bindings.
/// This is not exported to bindings users as general type aliases don't make sense in bindings.
pub type SimpleRefPeerManager<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j, 'k, 'l, 'm, SD, M, T, F, C, L> = PeerManager<SD, SimpleRefChannelManager<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'm, M, T, F, L>, &'f P2PGossipSync<&'g NetworkGraph<&'f L>, &'h C, &'f L>, &'i SimpleRefOnionMessenger<'j, 'k, L>, &'f L, IgnoringMessageHandler, &'c KeysManager>;

/// A PeerManager manages a set of peers, described by their [`SocketDescriptor`] and marshalls
Expand Down Expand Up @@ -646,7 +646,7 @@ impl<Descriptor: SocketDescriptor, CM: Deref, OM: Deref, L: Deref, NS: Deref> Pe
/// timestamp, however if it is not available a persistent counter that increases once per
/// minute should suffice.
///
/// (C-not exported) as we can't export a PeerManager with a dummy route handler
/// This is not exported to bindings users as we can't export a PeerManager with a dummy route handler
pub fn new_channel_only(channel_message_handler: CM, onion_message_handler: OM, current_time: u32, ephemeral_random_data: &[u8; 32], logger: L, node_signer: NS) -> Self {
Self::new(MessageHandler {
chan_handler: channel_message_handler,
Expand All @@ -673,7 +673,7 @@ impl<Descriptor: SocketDescriptor, RM: Deref, L: Deref, NS: Deref> PeerManager<D
/// `ephemeral_random_data` is used to derive per-connection ephemeral keys and must be
/// cryptographically secure random bytes.
///
/// (C-not exported) as we can't export a PeerManager with a dummy channel handler
/// This is not exported to bindings users as we can't export a PeerManager with a dummy channel handler
pub fn new_routing_only(routing_message_handler: RM, current_time: u32, ephemeral_random_data: &[u8; 32], logger: L, node_signer: NS) -> Self {
Self::new(MessageHandler {
chan_handler: ErroringMessageHandler::new(),
Expand Down
4 changes: 2 additions & 2 deletions lightning/src/onion_message/messenger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -463,15 +463,15 @@ impl<ES: Deref, NS: Deref, L: Deref, CMH: Deref> OnionMessageProvider for OnionM
/// Useful for simplifying the parameters of [`SimpleArcChannelManager`] and
/// [`SimpleArcPeerManager`]. See their docs for more details.
///
/// (C-not exported) as `Arc`s don't make sense in bindings.
/// This is not exported to bindings users as `Arc`s don't make sense in bindings.
///
/// [`SimpleArcChannelManager`]: crate::ln::channelmanager::SimpleArcChannelManager
/// [`SimpleArcPeerManager`]: crate::ln::peer_handler::SimpleArcPeerManager
pub type SimpleArcOnionMessenger<L> = OnionMessenger<Arc<KeysManager>, Arc<KeysManager>, Arc<L>, IgnoringMessageHandler>;
/// Useful for simplifying the parameters of [`SimpleRefChannelManager`] and
/// [`SimpleRefPeerManager`]. See their docs for more details.
///
/// (C-not exported) as general type aliases don't make sense in bindings.
/// This is not exported to bindings users as general type aliases don't make sense in bindings.
///
/// [`SimpleRefChannelManager`]: crate::ln::channelmanager::SimpleRefChannelManager
/// [`SimpleRefPeerManager`]: crate::ln::peer_handler::SimpleRefPeerManager
Expand Down
4 changes: 2 additions & 2 deletions lightning/src/onion_message/packet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,15 @@ pub enum OnionMessageContents<T: CustomOnionMessageContents> {
impl<T: CustomOnionMessageContents> OnionMessageContents<T> {
/// Returns the type that was used to decode the message payload.
///
/// (C-not exported) as methods on non-cloneable enums are not currently exportable
/// This is not exported to bindings users as methods on non-cloneable enums are not currently exportable
pub fn tlv_type(&self) -> u64 {
match self {
&OnionMessageContents::Custom(ref msg) => msg.tlv_type(),
}
}
}

/// (C-not exported) as methods on non-cloneable enums are not currently exportable
/// This is not exported to bindings users as methods on non-cloneable enums are not currently exportable
impl<T: CustomOnionMessageContents> Writeable for OnionMessageContents<T> {
fn write<W: Writer>(&self, w: &mut W) -> Result<(), io::Error> {
match self {
Expand Down
Loading