Skip to content

Conversation

@seqre
Copy link
Member

@seqre seqre commented Jan 11, 2026

This PR attempts to extract the core functionality of the framework to separate crate to speed up compilation among other reasons.

The modules fully/partially moved:

  • basic Cot types
  • body
  • error
  • headers
  • html
  • json
  • response
  • request
  • middleware
  • handler

I think moving router would be valid move as well, but in the current format it's too intertwined with OpenAPI functionality (that we don't want to pull into core) that it can be done at a later time.

With cot-core being a separate crate, the following items had to become public:

  • cot_core::error::backtrace
  • cot_core::error::error_impl::*
  • Error.backtrace()
  • NotFound.router()
  • Backtrace.frames()
  • StackFrame.symbol_name()
  • StackFrame.location()
  • StackFrame
  • Body.axum()
  • Body.wrapper()
  • Body.inner
  • BodyInner
  • InvalidContentType
  • AppName
  • RouteName
  • BoxRequestHandler
  • into_box_request_handler

@github-actions github-actions bot added the C-lib Crate: cot (main library crate) label Jan 11, 2026
@github-actions

This comment was marked as resolved.

@seqre seqre force-pushed the cot-core-reloaded branch from a799923 to c1c890a Compare January 11, 2026 19:30
@seqre seqre self-assigned this Jan 11, 2026
@seqre seqre requested review from ElijahAhianyo and m4tx January 11, 2026 19:36
@seqre seqre marked this pull request as ready for review January 11, 2026 19:36
Copilot AI review requested due to automatic review settings January 11, 2026 19:36

This comment was marked as resolved.

@seqre
Copy link
Member Author

seqre commented Jan 12, 2026

The nightly error should be fixed by rust-lang/rust#150939

@seqre seqre force-pushed the cot-core-reloaded branch from 0033822 to ead28ff Compare January 12, 2026 18:59
Copilot AI review requested due to automatic review settings January 12, 2026 18:59

This comment was marked as duplicate.

Copy link
Member

@m4tx m4tx left a comment

Choose a reason for hiding this comment

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

Looks nice, and seems like it lays a solid foundation for our eventual extraction of the ORM to a separate crate!

I've tried to generate the docs with just docs and it seems like there's a ton of warnings coming from cot-core (outside of missing examples, which are expected) - please make sure these are fixed before we consider merging this.

}

/// Private marker type used to distinguish `FromRequest` parameter position in
/// trait impls. This is used instead of `()` to avoid coherence conflicts.
Copy link
Member

Choose a reason for hiding this comment

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

Can you elaborate more about this? What's the exact issue this is trying to solve?

Copy link
Member Author

Choose a reason for hiding this comment

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

During refactor cargo would complain about double implementations, but I was able to remove it now and it works. I suppose it was because the refactor was not finished. I removed it.

Self::build_error_data(&mut error_data, error);
}
Kind::WithMessage(message) => {
Kind::WithMessage { 0: message, .. } => {
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps it makes sense to change this enum variant to be a struct variant with named field rather than enum variant? After all, we might (however unlikely) want to add some more fields to it, at which point we'll probably need to add some naming so it's clear what they do. Think "future-proofing the APIs".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-lib Crate: cot (main library crate)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants