-
Notifications
You must be signed in to change notification settings - Fork 221
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
66f15e2
commit 2e841ff
Showing
9 changed files
with
290 additions
and
173 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package io.finch | ||
|
||
import com.twitter.io.{Buf, Reader} | ||
import java.nio.charset.Charset | ||
|
||
/** | ||
* A type-class that defines encoding of a stream in a shape of `S[F[_], A]` to Finagle's [[Reader]]. | ||
*/ | ||
trait EncodeStream[S[_[_], _], F[_], A] { | ||
|
||
type ContentType <: String | ||
|
||
def apply(s: S[F, A], cs: Charset): Reader[Buf] | ||
} | ||
|
||
object EncodeStream { | ||
|
||
type Aux[S[_[_], _], F[_], A, CT <: String] = | ||
EncodeStream[S, F, A] { type ContentType = CT } | ||
|
||
type Json[S[_[_],_], F[_], A] = Aux[S, F, A, Application.Json] | ||
|
||
type Text[S[_[_],_], F[_], A] = Aux[S, F, A, Text.Plain] | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.