pub struct HttpCommitSource { /* private fields */ }Expand description
A forge’s raw-file endpoint over HTTP (spec 3.5 §7.8.2): GET on a URL template, 404
for a file the commit does not hold.
| Placeholder | Becomes |
|---|---|
{repository}, {path} | The repository’s and the file’s names, / kept |
{repository_escaped}, {path_escaped} | The same with / escaped, for APIs that take one path segment |
{commit} | The full commit id |
| Forge | Template |
|---|---|
| GitHub | https://raw.githubusercontent.com/{repository}/{commit}/{path} |
| GitLab | https://gitlab.com/api/v4/projects/{repository_escaped}/repository/files/{path_escaped}/raw?ref={commit} |
Redirects are not followed, so a credential never reaches another host.
§Example
use adk_website::repository::source::{CommitSource, HttpCommitSource};
let source = HttpCommitSource::new("https://raw.githubusercontent.com/{repository}/{commit}/{path}")?;
let url = source.url("juniper/site", &"a".repeat(40), "content/pages/hours/en.md")?;
assert!(url.ends_with("/juniper/site/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/content/pages/hours/en.md"));Implementations§
Source§impl HttpCommitSource
impl HttpCommitSource
Sourcepub fn new(template: impl Into<String>) -> Result<Self>
pub fn new(template: impl Into<String>) -> Result<Self>
A source reading template, which names {commit} and {path} (or {path_escaped}).
§Errors
A template without those placeholders, or not an http or https URL.
Trait Implementations§
Source§impl Clone for HttpCommitSource
impl Clone for HttpCommitSource
Source§impl CommitSource for HttpCommitSource
impl CommitSource for HttpCommitSource
Source§fn read<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
repository: &'life1 str,
commit: &'life2 str,
path: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Bytes>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn read<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
repository: &'life1 str,
commit: &'life2 str,
path: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Bytes>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Source§fn changes<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_repository: &'life1 str,
_before: Option<&'life2 str>,
_commit: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<FileChange>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn changes<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_repository: &'life1 str,
_before: Option<&'life2 str>,
_commit: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<FileChange>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
The files
commit changes against before, when the source can list them; None
leaves the push’s own lists, which a forge may cut short. Read moreAuto Trait Implementations§
impl !Freeze for HttpCommitSource
impl !RefUnwindSafe for HttpCommitSource
impl !UnwindSafe for HttpCommitSource
impl Forget for HttpCommitSource
impl Move for HttpCommitSource
impl Send for HttpCommitSource
impl Sync for HttpCommitSource
impl Unpin for HttpCommitSource
impl UnsafeUnpin for HttpCommitSourcewhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
*const u8: UnsafeUnpin,
Align8<*mut ()>: UnsafeUnpin,
&'static Vtable: UnsafeUnpin,
*const ArcInner<ClientRef> is !null: UnsafeUnpin,
PhantomData<ArcInner<ClientRef>>: UnsafeUnpin,
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more